@tesouro/embedded-components-react 0.7.37 → 0.7.41

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 (36) hide show
  1. package/README.md +2 -2
  2. package/dist/fixtures/index.d.ts +1 -1
  3. package/dist/index.d.ts +21 -14
  4. package/dist/lib/CounterpartsWidget.d.ts +16 -14
  5. package/dist/lib/CounterpartsWidgetPublic.d.ts +16 -14
  6. package/dist/lib/CustomersWidget.d.ts +16 -14
  7. package/dist/lib/TransfersWidget.d.ts +5 -0
  8. package/dist/lib/WidgetSuite.d.ts +5 -0
  9. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/fieldInput/formatPhoneNumberInput.js +2 -2
  10. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/mocks/bankAccounts.js +5 -5
  11. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js +30 -29
  12. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/constants.js +6 -6
  13. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsTable.js +143 -95
  14. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsWidget.js +60 -48
  15. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/mocks/labels.js +1 -1
  16. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index.js +4 -4
  17. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index2.js +22 -15
  18. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index3.js +137 -135
  19. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +106 -108
  20. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +2 -2
  21. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +50 -50
  22. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +22 -22
  23. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  24. package/dist/libs/tesouro-embedded-components-react/transfers-widget/data-access/dist/index.js +2 -2
  25. package/dist/libs/tesouro-embedded-components-react/transfers-widget/data-access/dist/index3.js +6 -7
  26. package/dist/libs/tesouro-embedded-components-react/transfers-widget/data-access/dist/index6.js +14 -34
  27. package/dist/libs/tesouro-embedded-components-react/transfers-widget/data-access/dist/index7.js +16 -13
  28. package/dist/libs/tesouro-embedded-components-react/transfers-widget/data-access/dist/index8.js +4 -10
  29. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/TransfersWidgetInner.js +99 -75
  30. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/featureLabels.js +2 -1
  31. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/useTransfersPageState.js +49 -0
  32. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/mocks/labels.js +2 -1
  33. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/mocks/transfers.js +103 -85
  34. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransfersWidget.js +73 -61
  35. package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/labels.js +3 -0
  36. package/package.json +1 -1
@@ -1,133 +1,136 @@
1
- import { Button as e, DataTable as t, Input as n, Select as r, SelectContent as i, SelectItem as a, SelectTrigger as o, SelectValue as s, Skeleton as c } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { EmptyState as l } from "../../../shared/ui/dist/lib/EmptyState/EmptyState.js";
3
- import { ErrorState as u } from "../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
1
+ import { Button as e, DataTable as t, FilterBar as n, FilterMenuButton as r, FilterTag as i, MultiSelectFilter as a, Popover as o, PopoverContent as s, PopoverTrigger as c, SearchInput as l, Skeleton as u } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { EmptyState as d } from "../../../shared/ui/dist/lib/EmptyState/EmptyState.js";
3
+ import { ErrorState as f } from "../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
4
4
  import "../../../shared/ui/dist/index.js";
5
- import { COUNTERPARTS_SCREEN_LABELS_EN as d } from "./index2.js";
6
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
7
- import { ArrowDownIcon as m, ArrowUpDownIcon as h, ArrowUpIcon as g } from "lucide-react";
5
+ import { COUNTERPARTS_SCREEN_LABELS_EN as p } from "./index2.js";
6
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
7
+ import { ArrowDownIcon as _, ArrowUpDownIcon as v, ArrowUpIcon as y, ListFilter as b, PlusIcon as x } from "lucide-react";
8
8
  //#region ../../libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index3.js
9
- var _ = "all", v = [
9
+ var S = [
10
10
  10,
11
11
  25,
12
12
  50,
13
13
  100
14
- ], y = [
15
- "rgba(0,0,255,0.05)",
16
- "rgba(255,0,32,0.05)",
17
- "rgba(0,255,220,0.05)",
18
- "rgba(225,1,251,0.05)",
19
- "rgba(255,123,0,0.05)"
20
14
  ];
21
- function b(e) {
22
- let t = 0;
23
- for (let n = e.length - 1; n >= 0; --n) t += e.charCodeAt(n);
24
- return y[t % y.length];
25
- }
26
- function x({ labels: e, searchValue: t, onSearchChange: c, entityFilter: l, onEntityFilterChange: u, disabled: d, createAction: m }) {
27
- return /* @__PURE__ */ p("div", {
28
- className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:gap-2 ttw:px-4",
29
- children: [/* @__PURE__ */ f("div", {
30
- className: "ttw:w-80",
31
- children: /* @__PURE__ */ f(n, {
32
- placeholder: e.searchPlaceholder,
33
- value: t,
34
- disabled: d,
35
- onChange: (e) => c(e.target.value)
36
- })
37
- }), /* @__PURE__ */ p("div", {
38
- className: "ttw:ml-auto ttw:flex ttw:items-center ttw:gap-2",
39
- children: [/* @__PURE__ */ p(r, {
40
- value: l,
41
- onValueChange: u,
42
- disabled: d,
43
- children: [/* @__PURE__ */ f(o, {
44
- className: "ttw:w-44",
45
- children: /* @__PURE__ */ f(s, {})
46
- }), /* @__PURE__ */ p(i, { children: [
47
- /* @__PURE__ */ f(a, {
48
- value: _,
49
- children: e.entityFilterAll
50
- }),
51
- /* @__PURE__ */ f(a, {
52
- value: "individual",
53
- children: e.entityFilterIndividual
54
- }),
55
- /* @__PURE__ */ f(a, {
56
- value: "organization",
57
- children: e.entityFilterOrganization
15
+ function C({ labels: e, filters: t, disabled: u }) {
16
+ return /* @__PURE__ */ h(n, {
17
+ className: "ttw:flex-wrap ttw:px-4",
18
+ searchSlot: /* @__PURE__ */ h(l, {
19
+ value: t.searchValue,
20
+ onChange: (e) => t.onSearchChange(e.target.value),
21
+ placeholder: e.searchPlaceholder,
22
+ "aria-label": e.searchLabel,
23
+ disabled: u,
24
+ className: "ttw:min-w-64"
25
+ }),
26
+ menuSlot: /* @__PURE__ */ g(o, {
27
+ open: t.isPopoverOpen,
28
+ onOpenChange: (e) => {
29
+ e || t.onPopoverClose();
30
+ },
31
+ children: [/* @__PURE__ */ h(c, {
32
+ asChild: !0,
33
+ children: /* @__PURE__ */ h(r, {
34
+ activeCount: t.activeFilterCount,
35
+ onClick: (e) => {
36
+ t.isTypePanelOpen && e.preventDefault(), t.onMenuToggle();
37
+ },
38
+ disabled: u,
39
+ labels: { filters: e.filtersButton }
40
+ })
41
+ }), /* @__PURE__ */ g(s, {
42
+ align: "start",
43
+ className: t.isTypePanelOpen ? "ttw:w-56 ttw:p-0" : "ttw:w-52 ttw:p-0",
44
+ children: [t.isMenuOpen && /* @__PURE__ */ h("div", {
45
+ className: "ttw:p-1",
46
+ children: /* @__PURE__ */ g("button", {
47
+ type: "button",
48
+ className: "ttw:flex ttw:w-full ttw:cursor-pointer ttw:items-center ttw:gap-2 ttw:rounded-md ttw:px-2 ttw:py-1.5 ttw:text-xs ttw:font-medium ttw:transition-colors ttw:hover:bg-accent",
49
+ onClick: t.onTypeFieldSelect,
50
+ children: [/* @__PURE__ */ h(b, {
51
+ className: "ttw:size-4 ttw:shrink-0 ttw:text-muted-foreground",
52
+ "aria-hidden": !0
53
+ }), e.filterFieldType]
58
54
  })
59
- ] })]
60
- }), m]
61
- })]
55
+ }), t.isTypePanelOpen && /* @__PURE__ */ h(a, {
56
+ options: [...t.typeOptions],
57
+ selectedValues: [...t.selectedTypes],
58
+ onSelectionChange: t.onTypeChange
59
+ })]
60
+ })]
61
+ }),
62
+ activeChipsSlot: /* @__PURE__ */ g(m, { children: [t.chips.map((n) => /* @__PURE__ */ h(i, {
63
+ label: n.label,
64
+ variant: "default",
65
+ labels: { remove: e.filterChipRemove },
66
+ onDismiss: () => t.onRemoveChip(n.key)
67
+ }, n.key)), t.chips.length > 0 && /* @__PURE__ */ h("button", {
68
+ type: "button",
69
+ className: "ttw:cursor-pointer ttw:whitespace-nowrap ttw:text-xs ttw:text-muted-foreground ttw:transition-colors ttw:hover:text-foreground",
70
+ onClick: t.onClearAll,
71
+ children: e.clearAllFilters
72
+ })] })
62
73
  });
63
74
  }
64
- function S({ value: e, isLoading: t, colorClass: n }) {
65
- return /* @__PURE__ */ f("div", {
75
+ function w({ value: e, isLoading: t, colorClass: n }) {
76
+ return /* @__PURE__ */ h("div", {
66
77
  className: "ttw:flex ttw:justify-end",
67
- children: t ? /* @__PURE__ */ f(c, { className: "ttw:h-4 ttw:w-20" }) : /* @__PURE__ */ f("span", {
78
+ children: t ? /* @__PURE__ */ h(u, { className: "ttw:h-4 ttw:w-20" }) : /* @__PURE__ */ h("span", {
68
79
  className: n,
69
80
  children: e
70
81
  })
71
82
  });
72
83
  }
73
- function C({ mode: n, counterparts: r, isLoading: i, isError: a, sorting: o, onSortingChange: s, pageSize: c, onPageSizeChange: _, pageSizeOptions: y = v, hasNextPage: C, hasPrevPage: w, onNextPage: T, onPrevPage: E, searchValue: D, onSearchChange: O, entityFilter: k, onEntityFilterChange: A, isFiltering: j, canCreate: M = !0, isAccessRestricted: N, onCreateClick: P, onRowClick: F, onRetry: I, labels: L, emptyStateTestId: R, accessRestrictedTestId: z }) {
74
- let B = {
75
- ...d,
76
- ...L
77
- }, V = n === "customer", H = V ? B.columnReceivedAmount : B.columnTotalPaidToDate, U = V ? B.columnAmountDue : B.columnBalanceDue, W = [
84
+ function T({ mode: n, counterparts: r, isLoading: i, isError: a, errorTitle: o, errorDescription: s, sorting: c, onSortingChange: l, pageSize: u, onPageSizeChange: m, pageSizeOptions: b = S, hasNextPage: T, hasPrevPage: E, onNextPage: D, onPrevPage: O, filters: k, isFiltering: A, canCreate: j = !0, isAccessRestricted: M, onCreateClick: N, onRowClick: P, onRetry: F, labels: I, emptyStateTestId: L, accessRestrictedTestId: R }) {
85
+ let z = {
86
+ ...p,
87
+ ...I
88
+ }, B = n === "customer", V = B ? z.columnReceivedAmount : z.columnTotalPaidToDate, H = B ? z.columnAmountDue : z.columnBalanceDue, U = [
78
89
  {
79
90
  accessorKey: "name",
80
91
  enableSorting: !0,
81
92
  header: ({ column: t }) => {
82
93
  let n = t.getIsSorted();
83
- return /* @__PURE__ */ p("div", {
94
+ return /* @__PURE__ */ g("div", {
84
95
  className: "ttw:flex ttw:items-center ttw:gap-2 ttw:text-inherit",
85
- children: [B.columnName, /* @__PURE__ */ f(e, {
96
+ children: [z.columnName, /* @__PURE__ */ h(e, {
86
97
  variant: "ghost",
87
98
  size: "icon-sm",
88
- "aria-label": B.sortByName,
99
+ "aria-label": z.sortByName,
89
100
  onClick: () => t.toggleSorting(n === "asc"),
90
- children: f(n === "asc" ? g : n === "desc" ? m : h, { className: "ttw:size-4" })
101
+ children: h(n === "asc" ? y : n === "desc" ? _ : v, { className: "ttw:size-4" })
91
102
  })]
92
103
  });
93
104
  },
94
- cell: ({ row: e }) => /* @__PURE__ */ p("div", {
95
- className: "ttw:flex ttw:items-center ttw:gap-3",
96
- children: [V && /* @__PURE__ */ f("span", {
97
- "aria-hidden": !0,
98
- style: { backgroundColor: b(e.original.initials) },
99
- className: "ttw:flex ttw:size-10 ttw:shrink-0 ttw:items-center ttw:justify-center ttw:rounded-full ttw:text-base ttw:font-semibold ttw:text-foreground",
100
- children: e.original.initials
101
- }), /* @__PURE__ */ p("div", {
102
- className: "ttw:flex ttw:flex-col ttw:gap-1",
103
- children: [/* @__PURE__ */ f("span", {
104
- className: "ttw:font-semibold",
105
- children: e.original.name
106
- }), e.original.locationLabel && /* @__PURE__ */ f("span", {
107
- className: "ttw:text-sm ttw:text-muted-foreground",
108
- children: e.original.locationLabel
109
- })]
105
+ cell: ({ row: e }) => /* @__PURE__ */ g("div", {
106
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
107
+ children: [/* @__PURE__ */ h("span", {
108
+ className: "ttw:font-semibold",
109
+ children: e.original.name
110
+ }), e.original.locationLabel && /* @__PURE__ */ h("span", {
111
+ className: "ttw:text-sm ttw:text-muted-foreground",
112
+ children: e.original.locationLabel
110
113
  })]
111
114
  })
112
115
  },
113
- ...V ? [{
116
+ {
114
117
  accessorKey: "billedAmountLabel",
115
- header: () => /* @__PURE__ */ f("div", {
118
+ header: () => /* @__PURE__ */ h("div", {
116
119
  className: "ttw:text-right",
117
- children: B.columnBilledAmount
120
+ children: z.columnBilledAmount
118
121
  }),
119
- cell: ({ row: e }) => /* @__PURE__ */ f(S, {
122
+ cell: ({ row: e }) => /* @__PURE__ */ h(w, {
120
123
  value: e.original.billedAmountLabel,
121
124
  isLoading: e.original.isBilledAmountLoading
122
125
  })
123
- }] : [],
126
+ },
124
127
  {
125
128
  accessorKey: "receivedOrPaidAmountLabel",
126
- header: () => /* @__PURE__ */ f("div", {
129
+ header: () => /* @__PURE__ */ h("div", {
127
130
  className: "ttw:text-right",
128
- children: H
131
+ children: V
129
132
  }),
130
- cell: ({ row: e }) => /* @__PURE__ */ f(S, {
133
+ cell: ({ row: e }) => /* @__PURE__ */ h(w, {
131
134
  value: e.original.receivedOrPaidAmountLabel,
132
135
  isLoading: e.original.isReceivedOrPaidAmountLoading,
133
136
  colorClass: e.original.isReceivedOrPaidPositive ? "ttw:text-green-700" : void 0
@@ -135,63 +138,62 @@ function C({ mode: n, counterparts: r, isLoading: i, isError: a, sorting: o, onS
135
138
  },
136
139
  {
137
140
  accessorKey: "dueOrOwedAmountLabel",
138
- header: () => /* @__PURE__ */ f("div", {
141
+ header: () => /* @__PURE__ */ h("div", {
139
142
  className: "ttw:text-right",
140
- children: U
143
+ children: H
141
144
  }),
142
- cell: ({ row: e }) => /* @__PURE__ */ f(S, {
145
+ cell: ({ row: e }) => /* @__PURE__ */ h(w, {
143
146
  value: e.original.dueOrOwedAmountLabel,
144
147
  isLoading: e.original.isDueOrOwedAmountLoading
145
148
  })
146
149
  }
147
- ], G = V ? B.customersEmptyTitle : B.vendorsEmptyTitle, K = V ? B.customersEmptyDescription : B.vendorsEmptyDescription, q = V ? B.customersEmptyAction : B.vendorsEmptyAction, J = V ? B.customersFilterEmptyTitle : B.vendorsFilterEmptyTitle, Y = !j && !D && !r.length && !i, X = !(!M || N), Z = !(j || !X), Q = V ? B.createButton : B.vendorsCreateButton;
148
- return /* @__PURE__ */ f("div", {
150
+ ], W = B ? z.customersEmptyTitle : z.vendorsEmptyTitle, G = B ? z.customersEmptyDescription : z.vendorsEmptyDescription, K = B ? z.customersEmptyAction : z.vendorsEmptyAction, q = B ? z.customersFilterEmptyTitle : z.vendorsFilterEmptyTitle, J = !A && !k.searchValue && !r.length && !i, Y = !(!j || M), X = !(A || !Y), Z = !A && !i && !a && !r.length, Q = Y && !Z, $ = B ? z.createButton : z.vendorsCreateButton;
151
+ return /* @__PURE__ */ g("div", {
149
152
  className: "ttw:flex ttw:flex-col ttw:gap-4",
150
- children: N ? /* @__PURE__ */ f(u, {
151
- testId: z,
152
- title: B.accessRestrictedTitle,
153
- description: B.accessRestrictedDescription
154
- }) : a ? /* @__PURE__ */ f(u, {
155
- title: B.errorTitle,
156
- description: B.errorDescription,
157
- retryLabel: I ? B.errorRetry : void 0,
158
- onRetry: I
159
- }) : /* @__PURE__ */ f(t, {
160
- columns: W,
153
+ children: [Q && /* @__PURE__ */ h("div", {
154
+ className: "ttw:flex ttw:items-center ttw:justify-end ttw:gap-2",
155
+ children: /* @__PURE__ */ g(e, {
156
+ onClick: N,
157
+ children: [/* @__PURE__ */ h(x, { className: "ttw:size-4" }), $]
158
+ })
159
+ }), M ? /* @__PURE__ */ h(f, {
160
+ testId: R,
161
+ title: z.accessRestrictedTitle,
162
+ description: z.accessRestrictedDescription
163
+ }) : a ? /* @__PURE__ */ h(f, {
164
+ title: o,
165
+ description: s,
166
+ retryLabel: F ? z.errorRetry : void 0,
167
+ onRetry: F
168
+ }) : /* @__PURE__ */ h(t, {
169
+ columns: U,
161
170
  data: r,
162
171
  isLoading: i,
163
- sorting: o,
164
- onSortingChange: s,
165
- pageSize: c,
166
- onPageSizeChange: _,
167
- pageSizeOptions: y,
168
- hasNextPage: C,
169
- hasPrevPage: w,
170
- onNextPage: T,
171
- onPrevPage: E,
172
- onRowClick: F,
173
- rowAriaLabel: (e) => B.openRow(e.name),
174
- filterComponent: /* @__PURE__ */ f(x, {
175
- labels: B,
176
- searchValue: D,
177
- onSearchChange: O,
178
- entityFilter: k,
179
- onEntityFilterChange: A,
180
- disabled: Y,
181
- createAction: X ? /* @__PURE__ */ f(e, {
182
- onClick: P,
183
- children: Q
184
- }) : void 0
172
+ sorting: c,
173
+ onSortingChange: l,
174
+ pageSize: u,
175
+ onPageSizeChange: m,
176
+ pageSizeOptions: b,
177
+ hasNextPage: T,
178
+ hasPrevPage: E,
179
+ onNextPage: D,
180
+ onPrevPage: O,
181
+ onRowClick: P,
182
+ rowAriaLabel: (e) => z.openRow(e.name),
183
+ filterComponent: /* @__PURE__ */ h(C, {
184
+ labels: z,
185
+ filters: k,
186
+ disabled: J
185
187
  }),
186
- children: /* @__PURE__ */ f(l, {
187
- testId: R,
188
- title: j ? J : G,
189
- description: j ? B.filterEmptyDescription : K,
190
- actionLabel: Z ? q : void 0,
191
- onAction: Z ? P : void 0
188
+ children: /* @__PURE__ */ h(d, {
189
+ testId: L,
190
+ title: A ? q : W,
191
+ description: A ? z.filterEmptyDescription : G,
192
+ actionLabel: A ? z.filterEmptyAction : X ? K : void 0,
193
+ onAction: A ? k.onClearAll : X ? N : void 0
192
194
  })
193
- })
195
+ })]
194
196
  });
195
197
  }
196
198
  //#endregion
197
- export { C as CounterpartsScreen, C as default };
199
+ export { T as CounterpartsScreen, T as default };