@tesouro/embedded-components-react 0.11.206 → 0.11.211

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 (89) hide show
  1. package/dist/index.css +13 -126
  2. package/dist/index.d.ts +6 -5
  3. package/dist/lib/ReceivablesWidget.d.ts +6 -5
  4. package/dist/lib/WidgetSuite.d.ts +6 -5
  5. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivableAttachmentsSection.js +1 -1
  6. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivableCustomerSection.js +1 -1
  7. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +16 -18
  8. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js +186 -239
  9. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +59 -52
  10. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +5 -4
  11. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentRecord.js +5 -5
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentTerms.js +1 -1
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/preview.js +1 -1
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurrence.js +1 -1
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurringSeries.js +19 -23
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/reminders.js +1 -1
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/statusColors.js +34 -0
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +2 -6
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActionsModal.js +5 -1
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +16 -16
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +1 -1
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablePaymentRecord.js +1 -2
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js +2 -0
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +28 -27
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +18 -120
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +89 -84
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +91 -36
  28. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +41 -2
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +2 -12
  30. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +9 -9
  31. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +9 -25
  32. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +26 -208
  33. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +209 -52
  34. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +50 -208
  35. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +186 -138
  36. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +157 -12
  37. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +10 -19
  38. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +23 -2
  39. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +2 -116
  40. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +117 -3
  41. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +3 -198
  42. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +198 -2
  43. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +2 -54
  44. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +14 -19
  45. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +22 -8
  46. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +40 -77
  47. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +17 -37
  48. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +8 -18
  49. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +61 -38
  50. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +27 -27
  51. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +26 -15
  52. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +14 -6
  53. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +19 -35
  54. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +31 -14
  55. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +67 -24
  56. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +391 -84
  57. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index43.js +2 -494
  58. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +47 -2
  59. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +62 -38
  60. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js +433 -61
  61. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +176 -428
  62. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index48.js +20 -224
  63. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index49.js +6 -21
  64. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +264 -0
  65. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index52.js +2 -264
  66. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index53.js +131 -2
  67. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index54.js +22 -126
  68. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index55.js +235 -23
  69. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index56.js +3 -239
  70. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index57.js +247 -3
  71. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index58.js +26 -244
  72. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index59.js +183 -26
  73. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index60.js +21 -194
  74. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index61.js +143 -21
  75. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index62.js +2 -143
  76. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index63.js +47 -2
  77. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index16.js +47 -48
  78. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index17.js +127 -144
  79. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index3.js +0 -3
  80. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index16.js +107 -111
  81. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index5.js +1 -1
  82. package/dist/libs/tesouro-embedded-components-react/shared/document-status/ui/dist/index.js +2 -2
  83. package/dist/libs/tesouro-embedded-components-react/shared/document-status/ui/dist/index7.js +2 -31
  84. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  85. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/helpers.js +1 -1
  86. package/dist/packages/shared-ui-shadcn/dist/index.js +1554 -1544
  87. package/package.json +1 -1
  88. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index50.js +0 -7
  89. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index64.js +0 -47
@@ -1,211 +1,53 @@
1
- import { Alert as e, AlertDescription as t, AlertTitle as n, Badge as r, Button as i, Field as a, FieldContent as o, FieldError as s, FieldLabel as c, Input as l, Select as u, SelectContent as d, SelectItem as f, SelectSeparator as p, SelectTrigger as m, SelectValue as h, Skeleton as g, Typography as _ } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { RECEIVABLE_FORM_DIALOG_LABELS_EN as v } from "./index18.js";
3
- import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
4
- import { PlusIcon as S, TriangleAlertIcon as C } from "lucide-react";
1
+ import { Button as e, Dialog as t, DialogContent as n, DialogDescription as r, DialogFooter as i, DialogHeader as a, DialogTitle as o, Label as s, Textarea as c } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { RECEIVABLE_ACTION_DIALOG_LABELS_EN as l } from "./index19.js";
3
+ import { useId as u } from "react";
4
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
5
5
  // ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js
6
- var w = "__add_new__";
7
- function T({ id: e, label: t, optionalSuffix: n, placeholder: r, value: i, error: u, disabled: d, onChange: f }) {
8
- return /* @__PURE__ */ b(a, { children: /* @__PURE__ */ x(o, { children: [
9
- /* @__PURE__ */ x(c, {
10
- htmlFor: e,
11
- className: "ttw:gap-1",
12
- children: [t, n && /* @__PURE__ */ b(_, {
13
- variant: "body2",
14
- component: "span",
15
- color: "muted",
16
- className: "ttw:leading-snug",
17
- children: n
18
- })]
19
- }),
20
- /* @__PURE__ */ b(l, {
21
- id: e,
22
- placeholder: r,
23
- value: i,
24
- disabled: d,
25
- "aria-invalid": !!u,
26
- onChange: (e) => f(e.target.value),
27
- onKeyDown: (e) => {
28
- e.key === "Enter" && e.preventDefault();
29
- }
30
- }),
31
- /* @__PURE__ */ b(s, { errors: u ? [{ message: u }] : [] })
32
- ] }) });
33
- }
34
- function E({ idPrefix: e, values: t, errors: n, canCancel: r, isSaving: a, labels: o, onChange: s, onSave: c, onCancel: l }) {
35
- return /* @__PURE__ */ x("div", {
36
- className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:rounded-xl ttw:border ttw:border-border ttw:p-3",
37
- children: [
38
- /* @__PURE__ */ b(_, {
39
- variant: "body2",
40
- children: o.bankAccountFormHeading
41
- }),
42
- /* @__PURE__ */ x("div", {
43
- className: "ttw:flex ttw:gap-4",
44
- children: [/* @__PURE__ */ b(T, {
45
- id: `${e}-routing-number`,
46
- label: o.bankAccountRoutingNumberLabel,
47
- placeholder: o.bankAccountRoutingNumberPlaceholder,
48
- value: t.routingNumber,
49
- error: n.routingNumber,
50
- disabled: a,
51
- onChange: (e) => s({ routingNumber: e })
52
- }), /* @__PURE__ */ b(T, {
53
- id: `${e}-account-number`,
54
- label: o.bankAccountAccountNumberLabel,
55
- placeholder: o.bankAccountAccountNumberPlaceholder,
56
- value: t.accountNumber,
57
- error: n.accountNumber,
58
- disabled: a,
59
- onChange: (e) => s({ accountNumber: e })
60
- })]
61
- }),
62
- /* @__PURE__ */ x("div", {
63
- className: "ttw:flex ttw:gap-4",
64
- children: [/* @__PURE__ */ b(T, {
65
- id: `${e}-account-holder-name`,
66
- label: o.bankAccountHolderNameLabel,
67
- placeholder: o.bankAccountHolderNamePlaceholder,
68
- value: t.accountHolderName,
69
- error: n.accountHolderName,
70
- disabled: a,
71
- onChange: (e) => s({ accountHolderName: e })
72
- }), /* @__PURE__ */ b(T, {
73
- id: `${e}-account-nickname`,
74
- label: o.bankAccountNicknameLabel,
75
- optionalSuffix: o.optionalSuffix,
76
- placeholder: o.bankAccountNicknamePlaceholder,
77
- value: t.displayName,
78
- error: n.displayName,
79
- disabled: a,
80
- onChange: (e) => s({ displayName: e })
81
- })]
82
- }),
83
- /* @__PURE__ */ x("div", {
84
- className: "ttw:flex ttw:gap-4",
85
- children: [r && /* @__PURE__ */ b(i, {
86
- type: "button",
87
- variant: "outline",
88
- className: "ttw:border-border",
89
- disabled: a,
90
- onClick: l,
91
- children: o.bankAccountCancelButton
92
- }), /* @__PURE__ */ b(i, {
93
- type: "button",
94
- disabled: a,
95
- onClick: c,
96
- children: o.bankAccountSaveButton
97
- })]
98
- })
99
- ]
100
- });
101
- }
102
- function D({ idPrefix: i, view: a, error: o, disabled: c, onAccountSelect: l, onAddAccountClick: T, onFormChange: D, onFormSave: O, onFormCancel: k, labels: A }) {
103
- let j = {
104
- ...v,
105
- ...A
106
- }, M = `${i}-bank-account`;
107
- return /* @__PURE__ */ x("div", {
108
- className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:rounded-xl ttw:border ttw:border-border ttw:p-6",
109
- children: [
110
- /* @__PURE__ */ x("div", {
111
- className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:pb-4",
112
- children: [/* @__PURE__ */ b(_, {
113
- variant: "h4",
114
- children: j.bankAccountHeading
115
- }), /* @__PURE__ */ b(_, {
116
- variant: "body2",
117
- color: "muted",
118
- className: "ttw:font-medium",
119
- children: j.bankAccountDescription
120
- })]
121
- }),
122
- (a.kind === "loading" || a.kind === "picker") && /* @__PURE__ */ x("div", {
123
- className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:rounded-xl ttw:border ttw:border-border ttw:p-3",
124
- children: [
125
- /* @__PURE__ */ x("div", {
126
- className: "ttw:flex ttw:flex-col ttw:gap-1",
127
- children: [/* @__PURE__ */ b(_, {
128
- variant: "body2",
129
- children: j.bankAccountLabel
130
- }), /* @__PURE__ */ b(_, {
131
- variant: "caption",
132
- color: "muted",
133
- children: j.bankAccountHint
134
- })]
135
- }),
136
- a.kind === "loading" ? /* @__PURE__ */ b(g, { className: "ttw:h-9 ttw:w-full ttw:rounded-md" }) : /* @__PURE__ */ x(u, {
137
- disabled: c,
138
- value: a.selected?.value ?? "",
139
- onValueChange: (e) => {
140
- e === w ? T() : l(e);
141
- },
142
- children: [/* @__PURE__ */ b(m, {
143
- id: M,
144
- className: "ttw:w-full",
145
- "aria-label": j.bankAccountSelectorLabel,
146
- "aria-invalid": !!o,
147
- children: /* @__PURE__ */ b(h, {
148
- placeholder: j.bankAccountPlaceholder,
149
- children: a.selected && /* @__PURE__ */ x("span", {
150
- className: "ttw:flex ttw:min-w-0 ttw:flex-1 ttw:items-center ttw:justify-between ttw:gap-2",
151
- children: [/* @__PURE__ */ b("span", {
152
- className: "ttw:truncate",
153
- children: a.selected.label
154
- }), a.selected.sourceLabel && /* @__PURE__ */ b(r, {
155
- variant: "secondary",
156
- className: "ttw:shrink-0",
157
- children: a.selected.sourceLabel
158
- })]
159
- })
160
- })
161
- }), /* @__PURE__ */ x(d, { children: [a.options.map((e) => /* @__PURE__ */ b(f, {
162
- value: e.value,
163
- children: /* @__PURE__ */ x("span", {
164
- className: "ttw:flex ttw:min-w-0 ttw:flex-1 ttw:items-center ttw:justify-between ttw:gap-2",
165
- children: [/* @__PURE__ */ b("span", {
166
- className: "ttw:truncate",
167
- children: e.label
168
- }), e.sourceLabel && /* @__PURE__ */ b("span", {
169
- className: "ttw:shrink-0 ttw:text-muted-foreground",
170
- children: e.sourceLabel
171
- })]
172
- })
173
- }, e.value)), a.canAddAccount && /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(p, {}), /* @__PURE__ */ x(f, {
174
- value: w,
175
- className: "ttw:font-semibold ttw:text-primary ttw:hover:text-primary ttw:focus:text-primary",
176
- children: [/* @__PURE__ */ b(S, { className: "ttw:text-primary" }), j.bankAccountAddOption]
177
- })] })] })]
178
- }),
179
- /* @__PURE__ */ b(s, { errors: o ? [{ message: o }] : [] })
180
- ]
181
- }),
182
- a.kind === "form" && /* @__PURE__ */ x("div", {
183
- className: "ttw:flex ttw:flex-col ttw:gap-2",
184
- "data-invalid": o ? !0 : void 0,
185
- children: [/* @__PURE__ */ b(E, {
186
- idPrefix: i,
187
- values: a.values,
188
- errors: a.errors,
189
- canCancel: a.canCancel,
190
- isSaving: a.isSaving,
191
- labels: j,
192
- onChange: D,
193
- onSave: O,
194
- onCancel: k
195
- }), /* @__PURE__ */ b(s, { errors: o ? [{ message: o }] : [] })]
196
- }),
197
- a.kind === "restricted" && /* @__PURE__ */ x(e, {
198
- className: "ttw:border-transparent ttw:bg-yellow-50 ttw:text-yellow-900 ttw:dark:bg-yellow-950 ttw:dark:text-yellow-100",
199
- children: [
200
- /* @__PURE__ */ b(C, {}),
201
- /* @__PURE__ */ b(n, { children: j.bankAccountRestrictedTitle }),
202
- /* @__PURE__ */ b(t, {
203
- className: "ttw:text-current",
204
- children: j.bankAccountRestrictedDescription
205
- })
206
- ]
207
- })
208
- ]
6
+ function p({ open: p, onOpenChange: m, title: h, description: g, confirmLabel: _, cancelLabel: v, destructive: y, inProgress: b, comment: x, onCommentChange: S, onConfirm: C, onCancel: w, labels: T }) {
7
+ let E = {
8
+ ...l,
9
+ ...T
10
+ }, D = u();
11
+ return /* @__PURE__ */ d(t, {
12
+ open: p,
13
+ onOpenChange: m,
14
+ children: /* @__PURE__ */ f(n, {
15
+ closeDisabled: b,
16
+ labels: { close: E.close },
17
+ className: "ttw:flex ttw:flex-col ttw:gap-6",
18
+ children: [
19
+ /* @__PURE__ */ f(a, { children: [/* @__PURE__ */ d(o, { children: h }), /* @__PURE__ */ d(r, {
20
+ className: "ttw:whitespace-pre-line",
21
+ children: Array.isArray(g) ? g.map((e) => /* @__PURE__ */ d("span", {
22
+ className: "ttw:block",
23
+ children: e
24
+ }, e)) : g
25
+ })] }),
26
+ x !== void 0 && /* @__PURE__ */ f("div", {
27
+ className: "ttw:flex ttw:flex-col ttw:gap-2",
28
+ children: [/* @__PURE__ */ d(s, {
29
+ htmlFor: D,
30
+ children: E.commentLabel
31
+ }), /* @__PURE__ */ d(c, {
32
+ id: D,
33
+ rows: 3,
34
+ placeholder: E.commentPlaceholder,
35
+ value: x,
36
+ onChange: (e) => S?.(e.target.value)
37
+ })]
38
+ }),
39
+ /* @__PURE__ */ f(i, { children: [/* @__PURE__ */ d(e, {
40
+ variant: "ghost",
41
+ onClick: w,
42
+ children: v ?? E.cancelButton
43
+ }), /* @__PURE__ */ d(e, {
44
+ variant: y ? "destructive" : "default",
45
+ loading: b,
46
+ onClick: C,
47
+ children: _ ?? E.confirmButton
48
+ })] })
49
+ ]
50
+ })
209
51
  });
210
52
  }
211
- export { D as ReceivableBankAccountSection };
53
+ export { p as ReceivableActionDialog, p as default };
@@ -1,160 +1,208 @@
1
- import { Button as e, Checkbox as t, Separator as n, Typography as r, cn as i } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { RECEIVABLE_FORM_DIALOG_LABELS_EN as a } from "./index18.js";
3
- import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
4
- import { FileText as l, ImageIcon as u, Loader2 as d, Trash2 as f, X as p } from "lucide-react";
1
+ import { Alert as e, AlertDescription as t, AlertTitle as n, Badge as r, Button as i, Field as a, FieldContent as o, FieldError as s, FieldLabel as c, Input as l, Select as u, SelectContent as d, SelectItem as f, SelectSeparator as p, SelectTrigger as m, SelectValue as h, Skeleton as g, Typography as _ } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { RECEIVABLE_FORM_DIALOG_LABELS_EN as v } from "./index19.js";
3
+ import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
4
+ import { PlusIcon as S, TriangleAlertIcon as C } from "lucide-react";
5
5
  // ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js
6
- function m({ view: m, isDragging: h, disabled: g, inputRef: _, onBrowseClick: v, onDragOver: y, onDragLeave: b, onDrop: x, onFilesSelect: S, onIncludeInEmailChange: C, onRemove: w, labels: T }) {
7
- let E = {
8
- ...a,
9
- ...T
10
- };
11
- return /* @__PURE__ */ c("div", {
6
+ var w = "__add_new__";
7
+ function T({ id: e, label: t, optionalSuffix: n, placeholder: r, value: i, error: u, disabled: d, onChange: f }) {
8
+ return /* @__PURE__ */ b(a, { children: /* @__PURE__ */ x(o, { children: [
9
+ /* @__PURE__ */ x(c, {
10
+ htmlFor: e,
11
+ className: "ttw:gap-1",
12
+ children: [t, n && /* @__PURE__ */ b(_, {
13
+ variant: "body2",
14
+ component: "span",
15
+ color: "muted",
16
+ className: "ttw:leading-snug",
17
+ children: n
18
+ })]
19
+ }),
20
+ /* @__PURE__ */ b(l, {
21
+ id: e,
22
+ placeholder: r,
23
+ value: i,
24
+ disabled: d,
25
+ "aria-invalid": !!u,
26
+ onChange: (e) => f(e.target.value),
27
+ onKeyDown: (e) => {
28
+ e.key === "Enter" && e.preventDefault();
29
+ }
30
+ }),
31
+ /* @__PURE__ */ b(s, { errors: u ? [{ message: u }] : [] })
32
+ ] }) });
33
+ }
34
+ function E({ idPrefix: e, values: t, errors: n, canCancel: r, isSaving: a, labels: o, onChange: s, onSave: c, onCancel: l }) {
35
+ return /* @__PURE__ */ x("div", {
36
+ className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:rounded-xl ttw:border ttw:border-border ttw:p-3",
37
+ children: [
38
+ /* @__PURE__ */ b(_, {
39
+ variant: "body2",
40
+ children: o.bankAccountFormHeading
41
+ }),
42
+ /* @__PURE__ */ x("div", {
43
+ className: "ttw:flex ttw:gap-4",
44
+ children: [/* @__PURE__ */ b(T, {
45
+ id: `${e}-routing-number`,
46
+ label: o.bankAccountRoutingNumberLabel,
47
+ placeholder: o.bankAccountRoutingNumberPlaceholder,
48
+ value: t.routingNumber,
49
+ error: n.routingNumber,
50
+ disabled: a,
51
+ onChange: (e) => s({ routingNumber: e })
52
+ }), /* @__PURE__ */ b(T, {
53
+ id: `${e}-account-number`,
54
+ label: o.bankAccountAccountNumberLabel,
55
+ placeholder: o.bankAccountAccountNumberPlaceholder,
56
+ value: t.accountNumber,
57
+ error: n.accountNumber,
58
+ disabled: a,
59
+ onChange: (e) => s({ accountNumber: e })
60
+ })]
61
+ }),
62
+ /* @__PURE__ */ x("div", {
63
+ className: "ttw:flex ttw:gap-4",
64
+ children: [/* @__PURE__ */ b(T, {
65
+ id: `${e}-account-holder-name`,
66
+ label: o.bankAccountHolderNameLabel,
67
+ placeholder: o.bankAccountHolderNamePlaceholder,
68
+ value: t.accountHolderName,
69
+ error: n.accountHolderName,
70
+ disabled: a,
71
+ onChange: (e) => s({ accountHolderName: e })
72
+ }), /* @__PURE__ */ b(T, {
73
+ id: `${e}-account-nickname`,
74
+ label: o.bankAccountNicknameLabel,
75
+ optionalSuffix: o.optionalSuffix,
76
+ placeholder: o.bankAccountNicknamePlaceholder,
77
+ value: t.displayName,
78
+ error: n.displayName,
79
+ disabled: a,
80
+ onChange: (e) => s({ displayName: e })
81
+ })]
82
+ }),
83
+ /* @__PURE__ */ x("div", {
84
+ className: "ttw:flex ttw:gap-4",
85
+ children: [r && /* @__PURE__ */ b(i, {
86
+ type: "button",
87
+ variant: "outline",
88
+ className: "ttw:border-border",
89
+ disabled: a,
90
+ onClick: l,
91
+ children: o.bankAccountCancelButton
92
+ }), /* @__PURE__ */ b(i, {
93
+ type: "button",
94
+ disabled: a,
95
+ onClick: c,
96
+ children: o.bankAccountSaveButton
97
+ })]
98
+ })
99
+ ]
100
+ });
101
+ }
102
+ function D({ idPrefix: i, view: a, error: o, disabled: c, onAccountSelect: l, onAddAccountClick: T, onFormChange: D, onFormSave: O, onFormCancel: k, labels: A }) {
103
+ let j = {
104
+ ...v,
105
+ ...A
106
+ }, M = `${i}-bank-account`;
107
+ return /* @__PURE__ */ x("div", {
12
108
  className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:rounded-xl ttw:border ttw:border-border ttw:p-6",
13
109
  children: [
14
- /* @__PURE__ */ c("div", {
110
+ /* @__PURE__ */ x("div", {
15
111
  className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:pb-4",
16
- children: [/* @__PURE__ */ s(r, {
112
+ children: [/* @__PURE__ */ b(_, {
17
113
  variant: "h4",
18
- children: E.attachmentsHeading
19
- }), /* @__PURE__ */ s(r, {
114
+ children: j.bankAccountHeading
115
+ }), /* @__PURE__ */ b(_, {
20
116
  variant: "body2",
21
117
  color: "muted",
22
118
  className: "ttw:font-medium",
23
- children: E.attachmentsDescription
119
+ children: j.bankAccountDescription
24
120
  })]
25
121
  }),
26
- m.showRows && /* @__PURE__ */ c("div", {
27
- className: "ttw:flex ttw:flex-col ttw:gap-2",
28
- children: [m.emailCaption && /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(r, {
29
- variant: "caption",
30
- color: "muted",
31
- children: m.emailCaption
32
- }), /* @__PURE__ */ s(n, {})] }), /* @__PURE__ */ c("ul", {
33
- className: "ttw:flex ttw:flex-col ttw:gap-2",
34
- children: [m.attachedRows.map((n) => /* @__PURE__ */ c("li", {
35
- className: "ttw:flex ttw:items-center ttw:gap-2",
36
- children: [/* @__PURE__ */ s(t, {
37
- checked: n.includeInEmail,
38
- disabled: g,
39
- "aria-label": n.includeInEmailLabel,
40
- onCheckedChange: (e) => C(n.id, e === !0)
41
- }), /* @__PURE__ */ c("div", {
42
- className: "ttw:flex ttw:w-full ttw:items-center ttw:gap-3 ttw:rounded-lg ttw:bg-muted ttw:px-2 ttw:py-1",
43
- children: [/* @__PURE__ */ c("div", {
44
- className: "ttw:flex ttw:min-w-0 ttw:flex-1 ttw:items-center ttw:gap-1",
45
- children: [/* @__PURE__ */ s(r, {
46
- variant: "body2",
47
- className: "ttw:truncate",
48
- children: n.name
49
- }), /* @__PURE__ */ c(r, {
50
- variant: "body2",
51
- color: "muted",
52
- className: "ttw:shrink-0",
53
- children: [
54
- "(",
55
- n.sizeLabel,
56
- ")"
57
- ]
58
- })]
59
- }), /* @__PURE__ */ s(e, {
60
- type: "button",
61
- variant: "ghost",
62
- size: "icon",
63
- className: "ttw:size-4",
64
- disabled: g,
65
- "aria-label": n.removeLabel,
66
- onClick: () => w(n.id),
67
- children: /* @__PURE__ */ s(f, { className: "ttw:size-4" })
68
- })]
122
+ (a.kind === "loading" || a.kind === "picker") && /* @__PURE__ */ x("div", {
123
+ className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:rounded-xl ttw:border ttw:border-border ttw:p-3",
124
+ children: [
125
+ /* @__PURE__ */ x("div", {
126
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
127
+ children: [/* @__PURE__ */ b(_, {
128
+ variant: "body2",
129
+ children: j.bankAccountLabel
130
+ }), /* @__PURE__ */ b(_, {
131
+ variant: "caption",
132
+ color: "muted",
133
+ children: j.bankAccountHint
69
134
  })]
70
- }, n.id)), m.pendingRows.map((t) => /* @__PURE__ */ c("li", {
71
- className: "ttw:flex ttw:w-full ttw:items-center ttw:gap-3 ttw:rounded-lg ttw:bg-muted ttw:px-2 ttw:py-1",
72
- children: [
73
- t.state === "uploading" ? /* @__PURE__ */ s(d, { className: "ttw:size-5 ttw:shrink-0 ttw:animate-spin ttw:text-muted-foreground" }) : /* @__PURE__ */ s(l, { className: "ttw:size-5 ttw:shrink-0 ttw:text-destructive" }),
74
- /* @__PURE__ */ c("div", {
75
- className: "ttw:flex ttw:min-w-0 ttw:flex-1 ttw:flex-col",
76
- children: [/* @__PURE__ */ s(r, {
77
- variant: "body2",
135
+ }),
136
+ a.kind === "loading" ? /* @__PURE__ */ b(g, { className: "ttw:h-9 ttw:w-full ttw:rounded-md" }) : /* @__PURE__ */ x(u, {
137
+ disabled: c,
138
+ value: a.selected?.value ?? "",
139
+ onValueChange: (e) => {
140
+ e === w ? T() : l(e);
141
+ },
142
+ children: [/* @__PURE__ */ b(m, {
143
+ id: M,
144
+ className: "ttw:w-full",
145
+ "aria-label": j.bankAccountSelectorLabel,
146
+ "aria-invalid": !!o,
147
+ children: /* @__PURE__ */ b(h, {
148
+ placeholder: j.bankAccountPlaceholder,
149
+ children: a.selected && /* @__PURE__ */ x("span", {
150
+ className: "ttw:flex ttw:min-w-0 ttw:flex-1 ttw:items-center ttw:justify-between ttw:gap-2",
151
+ children: [/* @__PURE__ */ b("span", {
152
+ className: "ttw:truncate",
153
+ children: a.selected.label
154
+ }), a.selected.sourceLabel && /* @__PURE__ */ b(r, {
155
+ variant: "secondary",
156
+ className: "ttw:shrink-0",
157
+ children: a.selected.sourceLabel
158
+ })]
159
+ })
160
+ })
161
+ }), /* @__PURE__ */ x(d, { children: [a.options.map((e) => /* @__PURE__ */ b(f, {
162
+ value: e.value,
163
+ children: /* @__PURE__ */ x("span", {
164
+ className: "ttw:flex ttw:min-w-0 ttw:flex-1 ttw:items-center ttw:justify-between ttw:gap-2",
165
+ children: [/* @__PURE__ */ b("span", {
78
166
  className: "ttw:truncate",
79
- children: t.name
80
- }), t.state === "uploading" ? /* @__PURE__ */ s(r, {
81
- variant: "caption",
82
- color: "muted",
83
- children: t.message
84
- }) : /* @__PURE__ */ s(r, {
85
- variant: "caption",
86
- role: "alert",
87
- className: "ttw:text-destructive",
88
- children: t.message
167
+ children: e.label
168
+ }), e.sourceLabel && /* @__PURE__ */ b("span", {
169
+ className: "ttw:shrink-0 ttw:text-muted-foreground",
170
+ children: e.sourceLabel
89
171
  })]
90
- }),
91
- /* @__PURE__ */ s(e, {
92
- type: "button",
93
- variant: "ghost",
94
- size: "icon",
95
- disabled: g,
96
- "aria-label": t.removeLabel,
97
- onClick: () => w(t.id),
98
- children: /* @__PURE__ */ s(p, { className: "ttw:size-4" })
99
172
  })
100
- ]
101
- }, t.id))]
102
- })]
103
- }),
104
- /* @__PURE__ */ c("button", {
105
- type: "button",
106
- disabled: g,
107
- onClick: v,
108
- onDragOver: (e) => {
109
- e.preventDefault(), y();
110
- },
111
- onDragLeave: (e) => {
112
- e.preventDefault(), b();
113
- },
114
- onDrop: (e) => {
115
- e.preventDefault(), x(e.dataTransfer.files);
116
- },
117
- className: i("ttw:flex ttw:w-full ttw:flex-col ttw:items-center ttw:gap-2 ttw:rounded-xl ttw:border ttw:border-dashed ttw:p-6 ttw:text-center ttw:disabled:cursor-not-allowed ttw:disabled:opacity-50", h ? "ttw:border-primary ttw:bg-primary/5" : "ttw:border-border ttw:bg-muted"),
118
- children: [
119
- /* @__PURE__ */ s("span", {
120
- className: "ttw:flex ttw:size-10 ttw:items-center ttw:justify-center ttw:rounded-full ttw:border ttw:border-border",
121
- children: /* @__PURE__ */ s(u, { className: "ttw:size-5 ttw:text-muted-foreground" })
122
- }),
123
- /* @__PURE__ */ c(r, {
124
- variant: "body2",
125
- children: [
126
- E.attachmentsDropPrompt,
127
- " ",
128
- /* @__PURE__ */ s("span", {
129
- className: "ttw:text-primary ttw:underline",
130
- children: E.attachmentsBrowseLink
131
- })
132
- ]
173
+ }, e.value)), a.canAddAccount && /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(p, {}), /* @__PURE__ */ x(f, {
174
+ value: w,
175
+ className: "ttw:font-semibold ttw:text-primary ttw:hover:text-primary ttw:focus:text-primary",
176
+ children: [/* @__PURE__ */ b(S, { className: "ttw:text-primary" }), j.bankAccountAddOption]
177
+ })] })] })]
133
178
  }),
134
- /* @__PURE__ */ s(r, {
135
- variant: "caption",
136
- color: "muted",
137
- children: E.attachmentsFormatsHint
138
- })
179
+ /* @__PURE__ */ b(s, { errors: o ? [{ message: o }] : [] })
139
180
  ]
140
181
  }),
141
- m.countLimitMessage && /* @__PURE__ */ s(r, {
142
- variant: "body2",
143
- role: "alert",
144
- className: "ttw:text-destructive",
145
- children: m.countLimitMessage
182
+ a.kind === "form" && /* @__PURE__ */ x("div", {
183
+ className: "ttw:flex ttw:flex-col ttw:gap-2",
184
+ "data-invalid": o ? !0 : void 0,
185
+ children: [/* @__PURE__ */ b(E, {
186
+ idPrefix: i,
187
+ values: a.values,
188
+ errors: a.errors,
189
+ canCancel: a.canCancel,
190
+ isSaving: a.isSaving,
191
+ labels: j,
192
+ onChange: D,
193
+ onSave: O,
194
+ onCancel: k
195
+ }), /* @__PURE__ */ b(s, { errors: o ? [{ message: o }] : [] })]
146
196
  }),
147
- /* @__PURE__ */ s("input", {
148
- ref: _,
149
- type: "file",
150
- multiple: !0,
151
- tabIndex: -1,
152
- "aria-hidden": !0,
153
- className: "ttw:sr-only",
154
- accept: m.accept,
155
- onChange: (e) => S(e.target.files)
197
+ a.kind === "restricted" && /* @__PURE__ */ x(e, {
198
+ variant: "warning",
199
+ children: [
200
+ /* @__PURE__ */ b(C, {}),
201
+ /* @__PURE__ */ b(n, { children: j.bankAccountRestrictedTitle }),
202
+ /* @__PURE__ */ b(t, { children: j.bankAccountRestrictedDescription })
203
+ ]
156
204
  })
157
205
  ]
158
206
  });
159
207
  }
160
- export { m as ReceivableAttachmentsSection };
208
+ export { D as ReceivableBankAccountSection };