@tesouro/embedded-components-react 0.5.263 → 0.5.265

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.
@@ -1,359 +1,194 @@
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, Skeleton as f, Tabs as ee, TabsList as te, TabsTrigger as p } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { EmptyState as m } from "../../../shared/ui/dist/lib/EmptyState/EmptyState.js";
3
- import { ErrorState as h } from "../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
1
+ import { Button as e, DataTable as t, Skeleton as n, Tooltip as r, TooltipContent as i, TooltipProvider as a, TooltipTrigger as o } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { EmptyState as s } from "../../../shared/ui/dist/lib/EmptyState/EmptyState.js";
3
+ import { ErrorState as c } from "../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
4
4
  import "../../../shared/ui/dist/index.js";
5
- import { RECEIVABLES_SCREEN_LABELS_EN as g } from "./index13.js";
6
- import { ReceivableStatusBadge as _ } from "./index22.js";
7
- import { ReceivableStatusCards as v } from "./index51.js";
8
- import { jsx as y, jsxs as b } from "react/jsx-runtime";
9
- import { ArrowDownIcon as x, ArrowUpDownIcon as S, ArrowUpIcon as C, LockKeyholeIcon as w, MoreHorizontalIcon as T, PlusIcon as E, SearchIcon as D, SettingsIcon as O } from "lucide-react";
5
+ import { RECEIVABLES_SCREEN_LABELS_EN as l } from "./index13.js";
6
+ import { ReceivableStatusBadge as u } from "./index22.js";
7
+ import { ReceivableStatusCards as d } from "./index51.js";
8
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
9
+ import { ArrowDownIcon as m, ArrowUpDownIcon as h, ArrowUpIcon as g, CogIcon as _, LockKeyholeIcon as v } from "lucide-react";
10
10
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index52.js
11
- var k = [
11
+ var y = [
12
12
  10,
13
13
  25,
14
14
  50,
15
15
  100
16
- ], A = "all";
17
- function j({ label: t, ariaLabel: n, column: r }) {
16
+ ];
17
+ function b({ label: t, ariaLabel: n, column: r }) {
18
18
  let i = r.getIsSorted();
19
- return /* @__PURE__ */ b("div", {
19
+ return /* @__PURE__ */ p("div", {
20
20
  className: "ttw:flex ttw:items-center ttw:gap-2 ttw:text-inherit",
21
- children: [t, /* @__PURE__ */ y(e, {
21
+ children: [t, /* @__PURE__ */ f(e, {
22
22
  variant: "ghost",
23
23
  size: "icon-sm",
24
24
  "aria-label": n,
25
25
  onClick: () => r.toggleSorting(i === "asc"),
26
- children: y(i === "asc" ? C : i === "desc" ? x : S, { className: "ttw:size-4" })
26
+ children: f(i === "asc" ? g : i === "desc" ? m : h, { className: "ttw:size-4" })
27
27
  })]
28
28
  });
29
29
  }
30
- function ne({ labels: e, searchValue: t, onSearchChange: n, statusFilter: r, statusOptions: i, onStatusFilterChange: a }) {
31
- return /* @__PURE__ */ b("div", {
32
- className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:gap-2 ttw:px-4",
33
- children: [/* @__PURE__ */ b("div", {
34
- className: "ttw:relative ttw:w-80",
35
- children: [/* @__PURE__ */ y(D, { 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, {
36
- className: "ttw:pl-9",
37
- placeholder: e.searchPlaceholder,
38
- value: t,
39
- onChange: (e) => n(e.target.value)
40
- })]
41
- }), /* @__PURE__ */ b(s, {
42
- value: r,
43
- onValueChange: a,
44
- children: [/* @__PURE__ */ y(u, {
45
- "aria-label": e.columnStatus,
46
- className: "ttw:w-48",
47
- children: /* @__PURE__ */ y(d, {})
48
- }), /* @__PURE__ */ b(c, { children: [/* @__PURE__ */ y(l, {
49
- value: A,
50
- children: e.statusFilterAll
51
- }), i.map((t) => /* @__PURE__ */ y(l, {
52
- value: t.value,
53
- children: N(t, e.statusBadge)
54
- }, t.value))] })]
55
- })]
56
- });
57
- }
58
- function M({ enabled: e, label: t, action: n, row: r, onActionClick: a, variant: o }) {
59
- return e ? /* @__PURE__ */ y(i, {
60
- variant: o,
61
- onClick: (e) => {
62
- e.stopPropagation(), a(n, r);
63
- },
64
- children: t
65
- }) : null;
66
- }
67
- function re({ row: e }) {
68
- return e.customerState === "resolving" ? /* @__PURE__ */ y(f, { className: "ttw:h-4 ttw:w-full" }) : e.customerState === "missing" ? /* @__PURE__ */ y("span", {
30
+ function x({ row: e }) {
31
+ return e.customerState === "resolving" ? /* @__PURE__ */ f(n, { className: "ttw:h-4 ttw:w-full" }) : e.customerState === "missing" ? /* @__PURE__ */ f("span", {
69
32
  className: "ttw:opacity-40",
70
33
  children: e.customerLabel
71
- }) : /* @__PURE__ */ y("span", { children: e.customerLabel });
34
+ }) : /* @__PURE__ */ f("span", { children: e.customerLabel });
72
35
  }
73
- function N(e, t) {
74
- return t[e.value] ?? e.label;
75
- }
76
- function P({ rows: i, activeTab: o, enabledTabs: s, onTabChange: c, isLoading: l, isError: u, isAccessRestricted: d, sorting: f, onSortingChange: x, pageSize: S, onPageSizeChange: C, pageSizeOptions: D = k, pageInfo: A, hasNextPage: N, hasPrevPage: P, onNextPage: F, onPrevPage: I, searchValue: L, onSearchChange: R, statusFilter: z, statusOptions: B, onStatusFilterChange: V, statusCards: H, onStatusCardSelect: U, filterBar: W, isFiltering: G, onCreateClick: K, onTemplateSettingsClick: q, onRowClick: J, onActionClick: Y, onRetry: X, labels: Z }) {
77
- let Q = {
78
- ...g,
79
- ...Z,
36
+ function S({ rows: n, isLoading: m, isError: h, isAccessRestricted: g, sorting: S, onSortingChange: C, pageSize: w, onPageSizeChange: T, pageSizeOptions: E = y, pageInfo: D, hasNextPage: O, hasPrevPage: k, onNextPage: A, onPrevPage: j, statusCards: M, onStatusCardSelect: N, filterBar: P, isFiltering: F, headerStart: I, bankAttribution: L, onCreateClick: R, onSettingsClick: z, onRowClick: B, onRetry: V, labels: H }) {
37
+ let U = {
38
+ ...l,
39
+ ...H,
80
40
  statusBadge: {
81
- ...g.statusBadge,
82
- ...Z?.statusBadge
41
+ ...l.statusBadge,
42
+ ...H?.statusBadge
83
43
  }
84
- }, $ = [
44
+ }, W = [
85
45
  {
86
- accessorKey: "documentLabel",
46
+ accessorKey: "dueDateLabel",
87
47
  enableSorting: !0,
88
- header: ({ column: e }) => /* @__PURE__ */ y(j, {
48
+ header: ({ column: e }) => /* @__PURE__ */ f(b, {
89
49
  column: e,
90
- label: Q.columnDocument,
91
- ariaLabel: Q.sortByDocument
92
- }),
93
- cell: ({ row: e }) => /* @__PURE__ */ b("div", {
94
- className: "ttw:flex ttw:flex-col ttw:gap-1",
95
- children: [/* @__PURE__ */ y("span", {
96
- className: "ttw:font-medium",
97
- children: e.original.documentLabel
98
- }), /* @__PURE__ */ y("span", {
99
- className: "ttw:text-xs ttw:text-muted-foreground",
100
- children: e.original.type === "credit_note" ? Q.tabCreditNotes : e.original.type === "quote" ? Q.tabQuotes : Q.tabInvoices
101
- })]
102
- }),
103
- minSize: 180
104
- },
105
- {
106
- accessorKey: "customerLabel",
107
- header: Q.columnCustomer,
108
- cell: ({ row: e }) => /* @__PURE__ */ y(re, { row: e.original }),
109
- minSize: 180
50
+ label: U.columnDueDate,
51
+ ariaLabel: U.sortByDueDate
52
+ })
110
53
  },
111
54
  {
112
55
  accessorKey: "status",
113
56
  enableSorting: !0,
114
- header: ({ column: e }) => /* @__PURE__ */ y(j, {
57
+ header: ({ column: e }) => /* @__PURE__ */ f(b, {
115
58
  column: e,
116
- label: Q.columnStatus,
117
- ariaLabel: Q.sortByStatus
59
+ label: U.columnStatus,
60
+ ariaLabel: U.sortByStatus
118
61
  }),
119
- cell: ({ row: e }) => /* @__PURE__ */ y(_, {
62
+ cell: ({ row: e }) => /* @__PURE__ */ f(u, {
120
63
  status: e.original.status,
121
64
  tone: e.original.statusTone,
122
- labels: Q.statusBadge
65
+ labels: U.statusBadge
123
66
  })
124
67
  },
125
68
  {
126
- accessorKey: "issueDateLabel",
69
+ accessorKey: "documentLabel",
127
70
  enableSorting: !0,
128
- header: ({ column: e }) => /* @__PURE__ */ y(j, {
71
+ header: ({ column: e }) => /* @__PURE__ */ f(b, {
129
72
  column: e,
130
- label: Q.columnIssueDate,
131
- ariaLabel: Q.sortByIssueDate
73
+ label: U.columnNumber,
74
+ ariaLabel: U.sortByNumber
132
75
  })
133
76
  },
134
77
  {
135
- accessorKey: "dueDateLabel",
78
+ accessorKey: "customerLabel",
79
+ header: U.columnCustomer,
80
+ cell: ({ row: e }) => /* @__PURE__ */ f(x, { row: e.original }),
81
+ minSize: 180
82
+ },
83
+ {
84
+ accessorKey: "issueDateLabel",
136
85
  enableSorting: !0,
137
- header: ({ column: e }) => /* @__PURE__ */ y(j, {
86
+ header: ({ column: e }) => /* @__PURE__ */ f(b, {
138
87
  column: e,
139
- label: Q.columnDueDate,
140
- ariaLabel: Q.sortByDueDate
88
+ label: U.columnIssueDate,
89
+ ariaLabel: U.sortByIssueDate
141
90
  })
142
91
  },
143
92
  {
144
93
  accessorKey: "totalLabel",
145
94
  enableSorting: !0,
146
- header: ({ column: e }) => /* @__PURE__ */ y("div", {
95
+ header: ({ column: e }) => /* @__PURE__ */ f("div", {
147
96
  className: "ttw:flex ttw:justify-end",
148
- children: /* @__PURE__ */ y(j, {
97
+ children: /* @__PURE__ */ f(b, {
149
98
  column: e,
150
- label: Q.columnTotal,
151
- ariaLabel: Q.sortByTotal
99
+ label: U.columnAmount,
100
+ ariaLabel: U.sortByAmount
152
101
  })
153
102
  }),
154
- cell: ({ row: e }) => /* @__PURE__ */ y("div", {
103
+ cell: ({ row: e }) => /* @__PURE__ */ f("div", {
155
104
  className: "ttw:text-right",
156
105
  children: e.original.totalLabel
157
106
  })
158
- },
159
- {
160
- accessorKey: "amountDueLabel",
161
- header: () => /* @__PURE__ */ y("div", {
162
- className: "ttw:text-right",
163
- children: Q.columnAmountDue
164
- }),
165
- cell: ({ row: e }) => /* @__PURE__ */ y("div", {
166
- className: "ttw:text-right",
167
- children: e.original.amountDueLabel
168
- })
169
107
  }
170
- ], ie = Y ? [...$, {
171
- id: "actions",
172
- header: () => /* @__PURE__ */ y("span", {
173
- className: "ttw:sr-only",
174
- children: Q.columnActions
175
- }),
176
- cell: ({ row: t }) => /* @__PURE__ */ y("div", {
177
- className: "ttw:flex ttw:justify-end",
178
- children: /* @__PURE__ */ b(n, { children: [/* @__PURE__ */ y(a, {
179
- asChild: !0,
180
- children: /* @__PURE__ */ y(e, {
181
- variant: "ghost",
182
- size: "icon-sm",
183
- "aria-label": Q.columnActions,
184
- onClick: (e) => e.stopPropagation(),
185
- children: /* @__PURE__ */ y(T, { className: "ttw:size-4" })
186
- })
187
- }), /* @__PURE__ */ b(r, {
188
- align: "end",
189
- children: [
190
- /* @__PURE__ */ y(M, {
191
- enabled: t.original.actions.edit,
192
- label: Q.actionEdit,
193
- action: "edit",
194
- row: t.original,
195
- onActionClick: Y
196
- }),
197
- /* @__PURE__ */ y(M, {
198
- enabled: t.original.actions.issue,
199
- label: Q.actionIssue,
200
- action: "issue",
201
- row: t.original,
202
- onActionClick: Y
203
- }),
204
- /* @__PURE__ */ y(M, {
205
- enabled: t.original.actions.send,
206
- label: Q.actionSend,
207
- action: "send",
208
- row: t.original,
209
- onActionClick: Y
210
- }),
211
- /* @__PURE__ */ y(M, {
212
- enabled: t.original.actions.recordPayment,
213
- label: Q.actionRecordPayment,
214
- action: "recordPayment",
215
- row: t.original,
216
- onActionClick: Y
217
- }),
218
- /* @__PURE__ */ y(M, {
219
- enabled: t.original.actions.markPaid,
220
- label: Q.actionMarkPaid,
221
- action: "markPaid",
222
- row: t.original,
223
- onActionClick: Y
224
- }),
225
- /* @__PURE__ */ y(M, {
226
- enabled: t.original.actions.markUncollectible,
227
- label: Q.actionMarkUncollectible,
228
- action: "markUncollectible",
229
- row: t.original,
230
- onActionClick: Y
231
- }),
232
- /* @__PURE__ */ y(M, {
233
- enabled: t.original.actions.accept,
234
- label: Q.actionAccept,
235
- action: "accept",
236
- row: t.original,
237
- onActionClick: Y
238
- }),
239
- /* @__PURE__ */ y(M, {
240
- enabled: t.original.actions.decline,
241
- label: Q.actionDecline,
242
- action: "decline",
243
- row: t.original,
244
- onActionClick: Y
245
- }),
246
- /* @__PURE__ */ y(M, {
247
- enabled: t.original.actions.cancel,
248
- label: Q.actionCancel,
249
- action: "cancel",
250
- row: t.original,
251
- onActionClick: Y
252
- }),
253
- /* @__PURE__ */ y(M, {
254
- enabled: t.original.actions.clone,
255
- label: Q.actionClone,
256
- action: "clone",
257
- row: t.original,
258
- onActionClick: Y
259
- }),
260
- /* @__PURE__ */ y(M, {
261
- enabled: t.original.actions.delete,
262
- label: Q.actionDelete,
263
- action: "delete",
264
- row: t.original,
265
- onActionClick: Y,
266
- variant: "destructive"
267
- })
268
- ]
269
- })] })
270
- }),
271
- size: 72
272
- }] : $;
273
- return /* @__PURE__ */ b("div", {
108
+ ];
109
+ return /* @__PURE__ */ p("div", {
274
110
  className: "ttw:flex ttw:flex-col ttw:gap-4",
275
111
  children: [
276
- /* @__PURE__ */ b("div", {
277
- className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:justify-between ttw:gap-3",
278
- children: [/* @__PURE__ */ y("div", {
279
- className: "ttw:flex ttw:items-center ttw:gap-3",
280
- children: !d && /* @__PURE__ */ y(ee, {
281
- value: o,
282
- onValueChange: (e) => c(e),
283
- children: /* @__PURE__ */ b(te, { children: [
284
- s.includes("invoices") && /* @__PURE__ */ y(p, {
285
- value: "invoices",
286
- children: Q.tabInvoices
287
- }),
288
- s.includes("quotes") && /* @__PURE__ */ y(p, {
289
- value: "quotes",
290
- children: Q.tabQuotes
291
- }),
292
- s.includes("credit_notes") && /* @__PURE__ */ y(p, {
293
- value: "credit_notes",
294
- children: Q.tabCreditNotes
295
- })
296
- ] })
297
- })
298
- }), /* @__PURE__ */ b("div", {
112
+ /* @__PURE__ */ p("div", {
113
+ className: "ttw:flex ttw:justify-between ttw:gap-4",
114
+ children: [/* @__PURE__ */ p("div", {
115
+ className: "ttw:flex ttw:flex-col ttw:gap-2",
116
+ children: [I, L && /* @__PURE__ */ p("div", {
117
+ className: "ttw:flex ttw:items-center ttw:gap-2",
118
+ children: [/* @__PURE__ */ f("span", {
119
+ className: "ttw:text-muted-foreground",
120
+ children: U.bankAttributionPrefix
121
+ }), /* @__PURE__ */ f("img", {
122
+ width: 120,
123
+ src: L.logoSrc,
124
+ alt: L.logoAlt
125
+ })]
126
+ })]
127
+ }), /* @__PURE__ */ p("div", {
299
128
  className: "ttw:flex ttw:items-center ttw:gap-2",
300
- children: [q && /* @__PURE__ */ b(e, {
301
- variant: "outline",
302
- onClick: q,
303
- children: [/* @__PURE__ */ y(O, { className: "ttw:size-4" }), Q.templateSettingsButton]
304
- }), K && /* @__PURE__ */ b(e, {
305
- onClick: K,
306
- children: [/* @__PURE__ */ y(E, { className: "ttw:size-4" }), Q.createButton]
129
+ children: [z && /* @__PURE__ */ f(a, { children: /* @__PURE__ */ p(r, { children: [/* @__PURE__ */ f(o, {
130
+ asChild: !0,
131
+ children: /* @__PURE__ */ f(e, {
132
+ type: "button",
133
+ variant: "outline",
134
+ size: "lg",
135
+ "aria-label": U.settingsButton,
136
+ onClick: z,
137
+ children: /* @__PURE__ */ f(_, {
138
+ className: "ttw:size-4.5",
139
+ "aria-hidden": !0
140
+ })
141
+ })
142
+ }), /* @__PURE__ */ f(i, {
143
+ sideOffset: 4,
144
+ children: U.settingsButton
145
+ })] }) }), R && /* @__PURE__ */ f(e, {
146
+ size: "lg",
147
+ onClick: R,
148
+ children: U.createInvoiceButton
307
149
  })]
308
150
  })]
309
151
  }),
310
- !d && H && U && /* @__PURE__ */ y(v, {
311
- view: H,
312
- onSelect: U,
313
- labels: { all: Q.statusCardsAll }
152
+ !g && M && N && /* @__PURE__ */ f(d, {
153
+ view: M,
154
+ onSelect: N,
155
+ labels: { all: U.statusCardsAll }
314
156
  }),
315
- d ? /* @__PURE__ */ y(h, {
316
- icon: /* @__PURE__ */ y(w, { className: "ttw:size-8 ttw:text-primary" }),
317
- title: Q.accessRestrictedTitle,
318
- description: Q.accessRestrictedDescription
319
- }) : u ? /* @__PURE__ */ y(h, {
320
- title: Q.errorTitle,
321
- description: Q.errorDescription,
322
- retryLabel: X ? Q.errorRetry : void 0,
323
- onRetry: X
324
- }) : /* @__PURE__ */ y(t, {
325
- columns: ie,
326
- data: i,
327
- isLoading: l,
328
- sorting: f,
329
- onSortingChange: x,
330
- pageSize: S,
331
- onPageSizeChange: C,
332
- pageSizeOptions: D,
333
- pageInfo: A,
334
- hasNextPage: N,
335
- hasPrevPage: P,
336
- onNextPage: F,
337
- onPrevPage: I,
338
- onRowClick: J,
339
- rowAriaLabel: (e) => Q.openRow(e.documentLabel),
340
- filterComponent: W ?? /* @__PURE__ */ y(ne, {
341
- labels: Q,
342
- searchValue: L,
343
- onSearchChange: R,
344
- statusFilter: z,
345
- statusOptions: B,
346
- onStatusFilterChange: V
347
- }),
348
- children: /* @__PURE__ */ y(m, {
349
- title: G ? Q.filterEmptyTitle : Q.emptyTitle,
350
- description: G ? Q.filterEmptyDescription : Q.emptyDescription,
351
- actionLabel: G ? void 0 : Q.emptyAction,
352
- onAction: G ? void 0 : K
157
+ g ? /* @__PURE__ */ f(c, {
158
+ icon: /* @__PURE__ */ f(v, { className: "ttw:size-8 ttw:text-primary" }),
159
+ title: U.accessRestrictedTitle,
160
+ description: U.accessRestrictedDescription
161
+ }) : h ? /* @__PURE__ */ f(c, {
162
+ title: U.errorTitle,
163
+ description: U.errorDescription,
164
+ retryLabel: V ? U.errorRetry : void 0,
165
+ onRetry: V
166
+ }) : /* @__PURE__ */ f(t, {
167
+ columns: W,
168
+ data: n,
169
+ isLoading: m,
170
+ sorting: S,
171
+ onSortingChange: C,
172
+ pageSize: w,
173
+ onPageSizeChange: T,
174
+ pageSizeOptions: E,
175
+ pageInfo: D,
176
+ hasNextPage: O,
177
+ hasPrevPage: k,
178
+ onNextPage: A,
179
+ onPrevPage: j,
180
+ onRowClick: B,
181
+ rowAriaLabel: (e) => U.openRow(e.documentLabel),
182
+ filterComponent: P,
183
+ children: /* @__PURE__ */ f(s, {
184
+ title: F ? U.filterEmptyTitle : U.emptyTitle,
185
+ description: F ? void 0 : U.emptyDescription,
186
+ actionLabel: F ? void 0 : U.createInvoiceButton,
187
+ onAction: F ? void 0 : R
353
188
  })
354
189
  })
355
190
  ]
356
191
  });
357
192
  }
358
193
  //#endregion
359
- export { P as ReceivablesScreen, P as default };
194
+ export { S as ReceivablesScreen, S as default };
@@ -1,5 +1,5 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.5.263", n = "759b6fc6c60363f415ccba2e5bb33c107e8f9697", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.5.265", n = "0676f5b86ffdc0c1cf0515490c9477ed48d76d77", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.5.263",
3
+ "version": "0.5.265",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "packageDepSync": {