@tesouro/embedded-components-react 0.5.204 → 0.5.205

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 (44) hide show
  1. package/README.md +15 -14
  2. package/dist/index.d.ts +38 -0
  3. package/dist/index.js +1 -1
  4. package/dist/lib/ReceivablesWidget.d.ts +38 -0
  5. package/dist/lib/ReceivablesWidget.js +1 -1
  6. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +7 -7
  7. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index2.js +26 -23
  8. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index3.js +79 -2
  9. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js +1 -1
  10. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +53 -42
  11. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +81 -283
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +47 -70
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +303 -99
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +68 -230
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +115 -0
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +253 -0
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js +1 -1
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js +34 -19
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +14 -0
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +10 -9
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js +18 -1
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +0 -3
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +0 -7
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +10 -0
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +1 -264
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +259 -67
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +61 -412
  28. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +407 -89
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +73 -60
  30. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +80 -331
  31. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index2.js +20 -0
  32. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +344 -0
  33. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +183 -137
  34. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index5.js +157 -20
  35. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +24 -1
  36. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +1 -3
  37. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index8.js +1 -1
  38. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +3 -18
  39. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +38 -38
  40. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +213 -202
  41. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +136 -116
  42. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  43. package/dist/packages/shared-ui-shadcn/dist/index.js +1763 -1749
  44. package/package.json +1 -1
@@ -0,0 +1,344 @@
1
+ import { Button as e, DataTable as t, DropdownMenu as n, DropdownMenuContent as r, DropdownMenuItem as i, DropdownMenuTrigger as a, Input as o, Select as s, SelectContent as c, SelectItem as l, SelectTrigger as u, SelectValue as d, Tabs as f, TabsList as p, TabsTrigger as m } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { EmptyState as h } from "../../../shared/ui/dist/lib/EmptyState/EmptyState.js";
3
+ import { ErrorState as g } from "../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
4
+ import "../../../shared/ui/dist/index.js";
5
+ import { RECEIVABLES_SCREEN_LABELS_EN as _ } from "./index2.js";
6
+ import { ReceivableStatusBadge as v } from "./index6.js";
7
+ import { jsx as y, jsxs as b } from "react/jsx-runtime";
8
+ import { ArrowDownIcon as x, ArrowUpDownIcon as S, ArrowUpIcon as C, MoreHorizontalIcon as w, PlusIcon as T, SearchIcon as E, SettingsIcon as D } from "lucide-react";
9
+ //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js
10
+ var O = [
11
+ 10,
12
+ 25,
13
+ 50,
14
+ 100
15
+ ], k = "all";
16
+ function A({ label: t, ariaLabel: n, column: r }) {
17
+ let i = r.getIsSorted();
18
+ return /* @__PURE__ */ b("div", {
19
+ className: "ttw:flex ttw:items-center ttw:gap-2 ttw:text-inherit",
20
+ children: [t, /* @__PURE__ */ y(e, {
21
+ variant: "ghost",
22
+ size: "icon-sm",
23
+ "aria-label": n,
24
+ onClick: () => r.toggleSorting(i === "asc"),
25
+ children: y(i === "asc" ? C : i === "desc" ? x : S, { className: "ttw:size-4" })
26
+ })]
27
+ });
28
+ }
29
+ function j({ labels: e, searchValue: t, onSearchChange: n, statusFilter: r, statusOptions: i, onStatusFilterChange: a }) {
30
+ return /* @__PURE__ */ b("div", {
31
+ className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:gap-2 ttw:px-4",
32
+ children: [/* @__PURE__ */ b("div", {
33
+ className: "ttw:relative ttw:w-80",
34
+ children: [/* @__PURE__ */ y(E, { className: "ttw:pointer-events-none ttw:absolute ttw:left-3 ttw:top-1/2 ttw:size-4 ttw:-translate-y-1/2 ttw:text-muted-foreground" }), /* @__PURE__ */ y(o, {
35
+ className: "ttw:pl-9",
36
+ placeholder: e.searchPlaceholder,
37
+ value: t,
38
+ onChange: (e) => n(e.target.value)
39
+ })]
40
+ }), /* @__PURE__ */ b(s, {
41
+ value: r,
42
+ onValueChange: a,
43
+ children: [/* @__PURE__ */ y(u, {
44
+ "aria-label": e.columnStatus,
45
+ className: "ttw:w-48",
46
+ children: /* @__PURE__ */ y(d, {})
47
+ }), /* @__PURE__ */ b(c, { children: [/* @__PURE__ */ y(l, {
48
+ value: k,
49
+ children: e.statusFilterAll
50
+ }), i.map((t) => /* @__PURE__ */ y(l, {
51
+ value: t.value,
52
+ children: N(t, e.statusBadge)
53
+ }, t.value))] })]
54
+ })]
55
+ });
56
+ }
57
+ function M({ enabled: e, label: t, action: n, row: r, onActionClick: a, variant: o }) {
58
+ return e ? /* @__PURE__ */ y(i, {
59
+ variant: o,
60
+ onClick: (e) => {
61
+ e.stopPropagation(), a(n, r);
62
+ },
63
+ children: t
64
+ }) : null;
65
+ }
66
+ function N(e, t) {
67
+ return t[e.value] ?? e.label;
68
+ }
69
+ function P({ rows: i, activeTab: o, enabledTabs: s, onTabChange: c, isLoading: l, isError: u, sorting: d, onSortingChange: x, pageSize: S, onPageSizeChange: C, pageSizeOptions: E = O, pageInfo: k, hasNextPage: N, hasPrevPage: P, onNextPage: F, onPrevPage: I, searchValue: L, onSearchChange: R, statusFilter: z, statusOptions: B, onStatusFilterChange: V, isFiltering: H, onCreateClick: U, onTemplateSettingsClick: W, onRowClick: G, onActionClick: K, onRetry: q, labels: J }) {
70
+ let Y = {
71
+ ..._,
72
+ ...J,
73
+ statusBadge: {
74
+ ..._.statusBadge,
75
+ ...J?.statusBadge
76
+ }
77
+ };
78
+ return /* @__PURE__ */ b("div", {
79
+ className: "ttw:flex ttw:flex-col ttw:gap-4",
80
+ children: [/* @__PURE__ */ b("div", {
81
+ className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:justify-between ttw:gap-3",
82
+ children: [/* @__PURE__ */ y("div", {
83
+ className: "ttw:flex ttw:items-center ttw:gap-3",
84
+ children: /* @__PURE__ */ y(f, {
85
+ value: o,
86
+ onValueChange: (e) => c(e),
87
+ children: /* @__PURE__ */ b(p, { children: [
88
+ s.includes("invoices") && /* @__PURE__ */ y(m, {
89
+ value: "invoices",
90
+ children: Y.tabInvoices
91
+ }),
92
+ s.includes("quotes") && /* @__PURE__ */ y(m, {
93
+ value: "quotes",
94
+ children: Y.tabQuotes
95
+ }),
96
+ s.includes("credit_notes") && /* @__PURE__ */ y(m, {
97
+ value: "credit_notes",
98
+ children: Y.tabCreditNotes
99
+ })
100
+ ] })
101
+ })
102
+ }), /* @__PURE__ */ b("div", {
103
+ className: "ttw:flex ttw:items-center ttw:gap-2",
104
+ children: [W && /* @__PURE__ */ b(e, {
105
+ variant: "outline",
106
+ onClick: W,
107
+ children: [/* @__PURE__ */ y(D, { className: "ttw:size-4" }), Y.templateSettingsButton]
108
+ }), /* @__PURE__ */ b(e, {
109
+ onClick: U,
110
+ children: [/* @__PURE__ */ y(T, { className: "ttw:size-4" }), Y.createButton]
111
+ })]
112
+ })]
113
+ }), u ? /* @__PURE__ */ y(g, {
114
+ title: Y.errorTitle,
115
+ description: Y.errorDescription,
116
+ retryLabel: q ? Y.errorRetry : void 0,
117
+ onRetry: q
118
+ }) : /* @__PURE__ */ y(t, {
119
+ columns: [
120
+ {
121
+ accessorKey: "documentLabel",
122
+ enableSorting: !0,
123
+ header: ({ column: e }) => /* @__PURE__ */ y(A, {
124
+ column: e,
125
+ label: Y.columnDocument,
126
+ ariaLabel: Y.sortByDocument
127
+ }),
128
+ cell: ({ row: e }) => /* @__PURE__ */ b("div", {
129
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
130
+ children: [/* @__PURE__ */ y("span", {
131
+ className: "ttw:font-medium",
132
+ children: e.original.documentLabel
133
+ }), /* @__PURE__ */ y("span", {
134
+ className: "ttw:text-xs ttw:text-muted-foreground",
135
+ children: e.original.type === "credit_note" ? Y.tabCreditNotes : e.original.type === "quote" ? Y.tabQuotes : Y.tabInvoices
136
+ })]
137
+ }),
138
+ minSize: 180
139
+ },
140
+ {
141
+ accessorKey: "customerLabel",
142
+ enableSorting: !0,
143
+ header: ({ column: e }) => /* @__PURE__ */ y(A, {
144
+ column: e,
145
+ label: Y.columnCustomer,
146
+ ariaLabel: Y.sortByCustomer
147
+ }),
148
+ minSize: 180
149
+ },
150
+ {
151
+ accessorKey: "status",
152
+ header: ({ column: e }) => /* @__PURE__ */ y(A, {
153
+ column: e,
154
+ label: Y.columnStatus,
155
+ ariaLabel: Y.sortByStatus
156
+ }),
157
+ cell: ({ row: e }) => /* @__PURE__ */ y(v, {
158
+ status: e.original.status,
159
+ tone: e.original.statusTone,
160
+ labels: Y.statusBadge
161
+ })
162
+ },
163
+ {
164
+ accessorKey: "issueDateLabel",
165
+ enableSorting: !0,
166
+ header: ({ column: e }) => /* @__PURE__ */ y(A, {
167
+ column: e,
168
+ label: Y.columnIssueDate,
169
+ ariaLabel: Y.sortByIssueDate
170
+ })
171
+ },
172
+ {
173
+ accessorKey: "dueDateLabel",
174
+ enableSorting: !0,
175
+ header: ({ column: e }) => /* @__PURE__ */ y(A, {
176
+ column: e,
177
+ label: Y.columnDueDate,
178
+ ariaLabel: Y.sortByDueDate
179
+ })
180
+ },
181
+ {
182
+ accessorKey: "totalLabel",
183
+ enableSorting: !0,
184
+ header: ({ column: e }) => /* @__PURE__ */ y("div", {
185
+ className: "ttw:flex ttw:justify-end",
186
+ children: /* @__PURE__ */ y(A, {
187
+ column: e,
188
+ label: Y.columnTotal,
189
+ ariaLabel: Y.sortByTotal
190
+ })
191
+ }),
192
+ cell: ({ row: e }) => /* @__PURE__ */ y("div", {
193
+ className: "ttw:text-right",
194
+ children: e.original.totalLabel
195
+ })
196
+ },
197
+ {
198
+ accessorKey: "amountDueLabel",
199
+ header: () => /* @__PURE__ */ y("div", {
200
+ className: "ttw:text-right",
201
+ children: Y.columnAmountDue
202
+ }),
203
+ cell: ({ row: e }) => /* @__PURE__ */ y("div", {
204
+ className: "ttw:text-right",
205
+ children: e.original.amountDueLabel
206
+ })
207
+ },
208
+ {
209
+ id: "actions",
210
+ header: () => /* @__PURE__ */ y("span", {
211
+ className: "ttw:sr-only",
212
+ children: Y.columnActions
213
+ }),
214
+ cell: ({ row: t }) => /* @__PURE__ */ y("div", {
215
+ className: "ttw:flex ttw:justify-end",
216
+ children: /* @__PURE__ */ b(n, { children: [/* @__PURE__ */ y(a, {
217
+ asChild: !0,
218
+ children: /* @__PURE__ */ y(e, {
219
+ variant: "ghost",
220
+ size: "icon-sm",
221
+ "aria-label": Y.columnActions,
222
+ onClick: (e) => e.stopPropagation(),
223
+ children: /* @__PURE__ */ y(w, { className: "ttw:size-4" })
224
+ })
225
+ }), /* @__PURE__ */ b(r, {
226
+ align: "end",
227
+ children: [
228
+ /* @__PURE__ */ y(M, {
229
+ enabled: t.original.actions.edit,
230
+ label: Y.actionEdit,
231
+ action: "edit",
232
+ row: t.original,
233
+ onActionClick: K
234
+ }),
235
+ /* @__PURE__ */ y(M, {
236
+ enabled: t.original.actions.issue,
237
+ label: Y.actionIssue,
238
+ action: "issue",
239
+ row: t.original,
240
+ onActionClick: K
241
+ }),
242
+ /* @__PURE__ */ y(M, {
243
+ enabled: t.original.actions.send,
244
+ label: Y.actionSend,
245
+ action: "send",
246
+ row: t.original,
247
+ onActionClick: K
248
+ }),
249
+ /* @__PURE__ */ y(M, {
250
+ enabled: t.original.actions.recordPayment,
251
+ label: Y.actionRecordPayment,
252
+ action: "recordPayment",
253
+ row: t.original,
254
+ onActionClick: K
255
+ }),
256
+ /* @__PURE__ */ y(M, {
257
+ enabled: t.original.actions.markPaid,
258
+ label: Y.actionMarkPaid,
259
+ action: "markPaid",
260
+ row: t.original,
261
+ onActionClick: K
262
+ }),
263
+ /* @__PURE__ */ y(M, {
264
+ enabled: t.original.actions.markUncollectible,
265
+ label: Y.actionMarkUncollectible,
266
+ action: "markUncollectible",
267
+ row: t.original,
268
+ onActionClick: K
269
+ }),
270
+ /* @__PURE__ */ y(M, {
271
+ enabled: t.original.actions.accept,
272
+ label: Y.actionAccept,
273
+ action: "accept",
274
+ row: t.original,
275
+ onActionClick: K
276
+ }),
277
+ /* @__PURE__ */ y(M, {
278
+ enabled: t.original.actions.decline,
279
+ label: Y.actionDecline,
280
+ action: "decline",
281
+ row: t.original,
282
+ onActionClick: K
283
+ }),
284
+ /* @__PURE__ */ y(M, {
285
+ enabled: t.original.actions.cancel,
286
+ label: Y.actionCancel,
287
+ action: "cancel",
288
+ row: t.original,
289
+ onActionClick: K
290
+ }),
291
+ /* @__PURE__ */ y(M, {
292
+ enabled: t.original.actions.clone,
293
+ label: Y.actionClone,
294
+ action: "clone",
295
+ row: t.original,
296
+ onActionClick: K
297
+ }),
298
+ /* @__PURE__ */ y(M, {
299
+ enabled: t.original.actions.delete,
300
+ label: Y.actionDelete,
301
+ action: "delete",
302
+ row: t.original,
303
+ onActionClick: K,
304
+ variant: "destructive"
305
+ })
306
+ ]
307
+ })] })
308
+ }),
309
+ size: 72
310
+ }
311
+ ],
312
+ data: i,
313
+ isLoading: l,
314
+ sorting: d,
315
+ onSortingChange: x,
316
+ pageSize: S,
317
+ onPageSizeChange: C,
318
+ pageSizeOptions: E,
319
+ pageInfo: k,
320
+ hasNextPage: N,
321
+ hasPrevPage: P,
322
+ onNextPage: F,
323
+ onPrevPage: I,
324
+ onRowClick: G,
325
+ rowAriaLabel: (e) => Y.openRow(e.documentLabel),
326
+ filterComponent: /* @__PURE__ */ y(j, {
327
+ labels: Y,
328
+ searchValue: L,
329
+ onSearchChange: R,
330
+ statusFilter: z,
331
+ statusOptions: B,
332
+ onStatusFilterChange: V
333
+ }),
334
+ children: /* @__PURE__ */ y(h, {
335
+ title: H ? Y.filterEmptyTitle : Y.emptyTitle,
336
+ description: H ? Y.filterEmptyDescription : Y.emptyDescription,
337
+ actionLabel: H ? void 0 : Y.emptyAction,
338
+ onAction: H ? void 0 : U
339
+ })
340
+ })]
341
+ });
342
+ }
343
+ //#endregion
344
+ export { P as ReceivablesScreen, P as default };
@@ -1,161 +1,207 @@
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_SHEET_LABELS_EN as a } from "./index2.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_SHEET_LABELS_EN as v } from "./index2.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
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.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, disabled: o, onAccountSelect: s, onAddAccountClick: c, onFormChange: l, onFormSave: T, onFormCancel: D, labels: O }) {
103
+ let k = {
104
+ ...v,
105
+ ...O
106
+ }, A = `${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: k.bankAccountHeading
115
+ }), /* @__PURE__ */ b(_, {
20
116
  variant: "body2",
21
117
  color: "muted",
22
118
  className: "ttw:font-medium",
23
- children: E.attachmentsDescription
119
+ children: k.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",
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: [/* @__PURE__ */ x("div", {
125
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
126
+ children: [/* @__PURE__ */ b(_, {
127
+ variant: "body2",
128
+ children: k.bankAccountLabel
129
+ }), /* @__PURE__ */ b(_, {
130
+ variant: "caption",
131
+ color: "muted",
132
+ children: k.bankAccountHint
133
+ })]
134
+ }), a.kind === "loading" ? /* @__PURE__ */ b(g, { className: "ttw:h-9 ttw:w-full ttw:rounded-md" }) : /* @__PURE__ */ x(u, {
135
+ disabled: o,
136
+ value: a.selected?.value ?? "",
137
+ onValueChange: (e) => {
138
+ if (e === w) {
139
+ c();
140
+ return;
141
+ }
142
+ s(e);
143
+ },
144
+ children: [/* @__PURE__ */ b(m, {
145
+ id: A,
146
+ className: "ttw:w-full",
147
+ "aria-label": k.bankAccountSelectorLabel,
148
+ children: /* @__PURE__ */ b(h, {
149
+ placeholder: k.bankAccountPlaceholder,
150
+ children: a.selected && /* @__PURE__ */ x("span", {
151
+ className: "ttw:flex ttw:min-w-0 ttw:flex-1 ttw:items-center ttw:justify-between ttw:gap-2",
152
+ children: [/* @__PURE__ */ b("span", {
47
153
  className: "ttw:truncate",
48
- children: n.name
49
- }), /* @__PURE__ */ c(r, {
50
- variant: "body2",
51
- color: "muted",
154
+ children: a.selected.label
155
+ }), a.selected.sourceLabel && /* @__PURE__ */ b(r, {
156
+ variant: "secondary",
52
157
  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
- })]
69
- })]
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",
78
- 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
158
+ children: a.selected.sourceLabel
89
159
  })]
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
160
  })
100
- ]
101
- }, t.id))]
161
+ })
162
+ }), /* @__PURE__ */ x(d, { children: [a.options.map((e) => /* @__PURE__ */ b(f, {
163
+ value: e.value,
164
+ children: /* @__PURE__ */ x("span", {
165
+ className: "ttw:flex ttw:min-w-0 ttw:flex-1 ttw:items-center ttw:justify-between ttw:gap-2",
166
+ children: [/* @__PURE__ */ b("span", {
167
+ className: "ttw:truncate",
168
+ children: e.label
169
+ }), e.sourceLabel && /* @__PURE__ */ b("span", {
170
+ className: "ttw:shrink-0 ttw:text-muted-foreground",
171
+ children: e.sourceLabel
172
+ })]
173
+ })
174
+ }, e.value)), a.canAddAccount && /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(p, {}), /* @__PURE__ */ x(f, {
175
+ value: w,
176
+ className: "ttw:font-semibold ttw:text-primary ttw:hover:text-primary ttw:focus:text-primary",
177
+ children: [/* @__PURE__ */ b(S, { className: "ttw:text-primary" }), k.bankAccountAddOption]
178
+ })] })] })]
102
179
  })]
103
180
  }),
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"),
181
+ a.kind === "form" && /* @__PURE__ */ b(E, {
182
+ idPrefix: i,
183
+ values: a.values,
184
+ errors: a.errors,
185
+ canCancel: a.canCancel,
186
+ isSaving: a.isSaving,
187
+ labels: k,
188
+ onChange: l,
189
+ onSave: T,
190
+ onCancel: D
191
+ }),
192
+ a.kind === "restricted" && /* @__PURE__ */ x(e, {
193
+ className: "ttw:border-transparent ttw:bg-yellow-50 ttw:text-yellow-900 ttw:dark:bg-yellow-950 ttw:dark:text-yellow-100",
118
194
  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
- ]
133
- }),
134
- /* @__PURE__ */ s(r, {
135
- variant: "caption",
136
- color: "muted",
137
- children: E.attachmentsFormatsHint
195
+ /* @__PURE__ */ b(C, {}),
196
+ /* @__PURE__ */ b(n, { children: k.bankAccountRestrictedTitle }),
197
+ /* @__PURE__ */ b(t, {
198
+ className: "ttw:text-current",
199
+ children: k.bankAccountRestrictedDescription
138
200
  })
139
201
  ]
140
- }),
141
- m.countLimitMessage && /* @__PURE__ */ s(r, {
142
- variant: "body2",
143
- role: "alert",
144
- className: "ttw:text-destructive",
145
- children: m.countLimitMessage
146
- }),
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)
156
202
  })
157
203
  ]
158
204
  });
159
205
  }
160
206
  //#endregion
161
- export { m as ReceivableAttachmentsSection };
207
+ export { D as ReceivableBankAccountSection };