@tesouro/embedded-components-react 0.11.102 → 0.11.105

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.
package/dist/index.d.ts CHANGED
@@ -5731,6 +5731,10 @@ interface ProductsWidgetOwnProps {
5731
5731
  /** Public props for {@link ProductsWidget}. */
5732
5732
  type ProductsWidgetProps = WidgetProviderProps & ProductsWidgetOwnProps;
5733
5733
 
5734
+ /** Kept off the exported {@link ProductsWidgetProps}: only Invoicing's tab row passes the slot. */
5735
+ interface ProductsWidgetInternalProps extends ProductsWidgetProps {
5736
+ headerActionContainer?: HTMLElement | null;
5737
+ }
5734
5738
  /**
5735
5739
  * Self-contained products/services widget: lists, filters, creates, edits,
5736
5740
  * views, and deletes products, and manages measure units. The provider/inner
@@ -5741,7 +5745,7 @@ type ProductsWidgetProps = WidgetProviderProps & ProductsWidgetOwnProps;
5741
5745
  * <ProductsWidget baseUrl="https://api.tesouro.com" widgetToken="wt_..." organizationId="org_..." />
5742
5746
  * ```
5743
5747
  */
5744
- declare function ProductsWidget({ baseUrl, widgetToken, organizationId, configClient, gatewayRouting, linkComponent, uiFramework, errorFallback, onError, analytics, disclosuresAcceptance, providerLabels, ...innerProps }: ProductsWidgetProps): React.JSX.Element;
5748
+ declare function ProductsWidget({ baseUrl, widgetToken, organizationId, configClient, gatewayRouting, linkComponent, uiFramework, errorFallback, onError, analytics, disclosuresAcceptance, providerLabels, ...innerProps }: ProductsWidgetInternalProps): React.JSX.Element;
5745
5749
 
5746
5750
  declare const InvoicesFilterField: {
5747
5751
  readonly DueDate: "dueDate";
@@ -873,6 +873,10 @@ interface ProductsWidgetOwnProps {
873
873
  /** Public props for {@link ProductsWidget}. */
874
874
  type ProductsWidgetProps = WidgetProviderProps & ProductsWidgetOwnProps;
875
875
 
876
+ /** Kept off the exported {@link ProductsWidgetProps}: only Invoicing's tab row passes the slot. */
877
+ interface ProductsWidgetInternalProps extends ProductsWidgetProps {
878
+ headerActionContainer?: HTMLElement | null;
879
+ }
876
880
  /**
877
881
  * Self-contained products/services widget: lists, filters, creates, edits,
878
882
  * views, and deletes products, and manages measure units. The provider/inner
@@ -883,7 +887,7 @@ type ProductsWidgetProps = WidgetProviderProps & ProductsWidgetOwnProps;
883
887
  * <ProductsWidget baseUrl="https://api.tesouro.com" widgetToken="wt_..." organizationId="org_..." />
884
888
  * ```
885
889
  */
886
- declare function ProductsWidget({ baseUrl, widgetToken, organizationId, configClient, gatewayRouting, linkComponent, uiFramework, errorFallback, onError, analytics, disclosuresAcceptance, providerLabels, ...innerProps }: ProductsWidgetProps): React.JSX.Element;
890
+ declare function ProductsWidget({ baseUrl, widgetToken, organizationId, configClient, gatewayRouting, linkComponent, uiFramework, errorFallback, onError, analytics, disclosuresAcceptance, providerLabels, ...innerProps }: ProductsWidgetInternalProps): React.JSX.Element;
887
891
 
888
892
  export { ProductsWidget };
889
893
  export type { MeasureUnitDeleteDialogLabels, MeasureUnitsManagerLabels, ProductDeleteDialogLabels, ProductDetailsSheetLabels, ProductFormSheetLabels, ProductMessageLabels, ProductsScreenLabels, ProductsWidgetProps };
@@ -19,95 +19,96 @@ import { useCounterpartsWidget as u } from "./useCounterpartsWidget.js";
19
19
  import { useEffect as d } from "react";
20
20
  import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
21
21
  // ../../libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js
22
- function h({ counterpartType: n, pageSizeOptions: o = l, onViewAllDocuments: h, onCreateDocument: g, screenLabels: _, formLabels: v, detailsLabels: y, bankAccountLabels: b, deleteLabels: x, messageLabels: S }) {
23
- let C = t();
22
+ function h({ counterpartType: n, pageSizeOptions: o = l, onViewAllDocuments: h, onCreateDocument: g, screenLabels: _, formLabels: v, detailsLabels: y, bankAccountLabels: b, deleteLabels: x, messageLabels: S, headerActionContainer: C }) {
23
+ let w = t();
24
24
  d(() => {
25
- C(a.Mounted);
26
- }, [C]);
27
- let { stateOptions: w, selectedId: T, view: E, table: D, listError: O, details: k, detailsSheetView: A, permissions: j, isPermissionLoading: M, actions: N, handleRowClick: P, closeDetails: F } = u({
25
+ w(a.Mounted);
26
+ }, [w]);
27
+ let { stateOptions: T, selectedId: E, view: D, table: O, listError: k, details: A, detailsSheetView: j, permissions: M, isPermissionLoading: N, actions: P, handleRowClick: F, closeDetails: I } = u({
28
28
  counterpartType: n,
29
29
  pageSizeOptions: o,
30
30
  detailsLabels: y,
31
31
  messageLabels: S,
32
32
  screenLabels: _
33
- }), { form: I } = N;
33
+ }), { form: L } = P;
34
34
  return /* @__PURE__ */ m(f, { children: [
35
35
  /* @__PURE__ */ p(e, {}),
36
36
  /* @__PURE__ */ p(s, {
37
37
  mode: n,
38
- counterparts: D.rows,
39
- isLoading: M || D.isLoading,
40
- isError: D.isError,
41
- errorTitle: O.title,
42
- errorDescription: O.description,
43
- sorting: D.sorting,
44
- onSortingChange: D.onSortingChange,
45
- pageSize: D.pageSize,
46
- onPageSizeChange: D.onPageSizeChange,
38
+ counterparts: O.rows,
39
+ isLoading: N || O.isLoading,
40
+ isError: O.isError,
41
+ errorTitle: k.title,
42
+ errorDescription: k.description,
43
+ sorting: O.sorting,
44
+ onSortingChange: O.onSortingChange,
45
+ pageSize: O.pageSize,
46
+ onPageSizeChange: O.onPageSizeChange,
47
47
  pageSizeOptions: o,
48
- hasNextPage: D.hasNextPage,
49
- hasPrevPage: D.hasPrevPage,
50
- onNextPage: D.onNextPage,
51
- onPrevPage: D.onPrevPage,
52
- filters: D.filters,
53
- isFiltering: D.isFiltering,
54
- isAmountsError: D.isAmountsError,
55
- onRetryAmounts: D.onRetryAmounts,
56
- canCreate: j.canCreate,
57
- isAccessRestricted: !M && !j.canRead,
58
- onCreateClick: j.canCreate ? I.openCreate : () => void 0,
59
- onRowClick: P,
60
- onRetry: D.onRetry,
48
+ hasNextPage: O.hasNextPage,
49
+ hasPrevPage: O.hasPrevPage,
50
+ onNextPage: O.onNextPage,
51
+ onPrevPage: O.onPrevPage,
52
+ filters: O.filters,
53
+ isFiltering: O.isFiltering,
54
+ isAmountsError: O.isAmountsError,
55
+ onRetryAmounts: O.onRetryAmounts,
56
+ canCreate: M.canCreate,
57
+ isAccessRestricted: !N && !M.canRead,
58
+ onCreateClick: M.canCreate ? L.openCreate : () => void 0,
59
+ onRowClick: F,
60
+ onRetry: O.onRetry,
61
+ headerActionContainer: C,
61
62
  labels: _,
62
63
  emptyStateTestId: "counterparts-widget-empty-state",
63
64
  accessRestrictedTestId: "counterparts-widget-access-restricted"
64
65
  }),
65
66
  /* @__PURE__ */ p(r, {
66
- open: E === "create",
67
+ open: D === "create",
67
68
  onOpenChange: (e) => {
68
- e || I.close();
69
+ e || L.close();
69
70
  },
70
71
  mode: "create",
71
72
  counterpartMode: n,
72
- values: I.values,
73
- errors: I.errors,
74
- stateOptions: w,
75
- taxIdField: i(I.values.entityType, n, v),
76
- inProgress: I.isSubmitting,
77
- onChange: (e) => I.setValues((t) => ({
73
+ values: L.values,
74
+ errors: L.errors,
75
+ stateOptions: T,
76
+ taxIdField: i(L.values.entityType, n, v),
77
+ inProgress: L.isSubmitting,
78
+ onChange: (e) => L.setValues((t) => ({
78
79
  ...t,
79
80
  ...e
80
81
  })),
81
- onAddressChange: (e) => I.setValues((t) => ({
82
+ onAddressChange: (e) => L.setValues((t) => ({
82
83
  ...t,
83
84
  address: {
84
85
  ...t.address,
85
86
  ...e
86
87
  }
87
88
  })),
88
- onBankAccountChange: (e) => I.setValues((t) => ({
89
+ onBankAccountChange: (e) => L.setValues((t) => ({
89
90
  ...t,
90
91
  bankAccount: {
91
92
  ...t.bankAccount,
92
93
  ...e
93
94
  }
94
95
  })),
95
- onSubmit: I.submit,
96
- onCancel: I.close,
96
+ onSubmit: L.submit,
97
+ onCancel: L.close,
97
98
  labels: v
98
99
  }),
99
100
  /* @__PURE__ */ p(c, {
100
101
  counterpartType: n,
101
- open: T !== void 0 && E !== "create",
102
- selectedId: T,
103
- view: E,
104
- details: k,
105
- detailsSheetView: A,
106
- actions: N,
107
- stateOptions: w,
108
- canEdit: j.canUpdate,
109
- canDelete: j.canDelete,
110
- onClose: F,
102
+ open: E !== void 0 && D !== "create",
103
+ selectedId: E,
104
+ view: D,
105
+ details: A,
106
+ detailsSheetView: j,
107
+ actions: P,
108
+ stateOptions: T,
109
+ canEdit: M.canUpdate,
110
+ canDelete: M.canDelete,
111
+ onClose: I,
111
112
  onViewAllDocuments: h,
112
113
  onCreateDocument: g,
113
114
  formLabels: v,
@@ -117,7 +118,7 @@ function h({ counterpartType: n, pageSizeOptions: o = l, onViewAllDocuments: h,
117
118
  })
118
119
  ] });
119
120
  }
120
- function g({ baseUrl: e, widgetToken: t, organizationId: r, configClient: i, gatewayRouting: a, linkComponent: s, uiFramework: c, errorFallback: l, onError: u, analytics: d, disclosuresAcceptance: f, providerLabels: m, passThrough: g, ..._ }) {
121
+ function g({ baseUrl: e, widgetToken: t, organizationId: r, configClient: i, gatewayRouting: a, linkComponent: s, uiFramework: c, errorFallback: l, onError: u, analytics: d, disclosuresAcceptance: f, providerLabels: m, passThrough: g, headerActionContainer: _, ...v }) {
121
122
  return /* @__PURE__ */ p(n, {
122
123
  widgetName: g === !0 && e === void 0 && t === void 0 ? void 0 : o,
123
124
  baseUrl: e,
@@ -132,7 +133,10 @@ function g({ baseUrl: e, widgetToken: t, organizationId: r, configClient: i, gat
132
133
  analytics: d,
133
134
  disclosuresAcceptance: f,
134
135
  providerLabels: m,
135
- children: /* @__PURE__ */ p(h, { ..._ }, _.counterpartType)
136
+ children: /* @__PURE__ */ p(h, {
137
+ ...v,
138
+ headerActionContainer: _
139
+ }, v.counterpartType)
136
140
  });
137
141
  }
138
142
  export { g as CounterpartsWidget, g as default };
@@ -4,6 +4,7 @@ import { ErrorState as h } from "../../../shared/ui/dist/lib/ErrorState/ErrorSta
4
4
  import { NoAccessState as g } from "../../../shared/ui/dist/lib/StatePanel/NoAccessState.js";
5
5
  import "../../../shared/ui/dist/index.js";
6
6
  import { COUNTERPARTS_SCREEN_LABELS_EN as _ } from "./index2.js";
7
+ import { createPortal as ee } from "react-dom";
7
8
  import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
8
9
  import { TriangleAlertIcon as x } from "lucide-react";
9
10
  // ../../libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index3.js
@@ -13,7 +14,7 @@ var S = [
13
14
  50,
14
15
  100
15
16
  ], C = "all";
16
- function w({ labels: e, filters: t, disabled: r, action: i }) {
17
+ function te({ labels: e, filters: t, disabled: r, action: i }) {
17
18
  return /* @__PURE__ */ y(p, {
18
19
  className: "ttw:px-4",
19
20
  search: /* @__PURE__ */ y(o, {
@@ -53,13 +54,13 @@ function w({ labels: e, filters: t, disabled: r, action: i }) {
53
54
  })] }) : void 0
54
55
  });
55
56
  }
56
- function T({ value: e, isLoading: t }) {
57
+ function w({ value: e, isLoading: t }) {
57
58
  return /* @__PURE__ */ y("div", {
58
59
  className: "ttw:flex ttw:justify-end ttw:tabular-nums",
59
60
  children: t ? /* @__PURE__ */ y(f, { className: "ttw:h-4 ttw:w-20" }) : e
60
61
  });
61
62
  }
62
- function E({ labels: r, onRetry: i }) {
63
+ function T({ labels: r, onRetry: i }) {
63
64
  return /* @__PURE__ */ b(e, {
64
65
  variant: "warning",
65
66
  children: [/* @__PURE__ */ y(x, {}), /* @__PURE__ */ y(t, { children: /* @__PURE__ */ b("div", {
@@ -74,17 +75,17 @@ function E({ labels: r, onRetry: i }) {
74
75
  }) })]
75
76
  });
76
77
  }
77
- function D({ mode: e, counterparts: t, isLoading: a, isError: o, errorTitle: s, errorDescription: c, sorting: l, onSortingChange: u, pageSize: d, onPageSizeChange: f, pageSizeOptions: p = S, hasNextPage: v, hasPrevPage: x, onNextPage: C, onPrevPage: D, filters: O, isFiltering: k, isAmountsError: A, onRetryAmounts: j, canCreate: M = !0, isAccessRestricted: N, onCreateClick: P, onRowClick: F, onRetry: I, labels: L, emptyStateTestId: R, accessRestrictedTestId: z }) {
78
- let B = {
78
+ function E({ mode: e, counterparts: t, isLoading: a, isError: o, errorTitle: s, errorDescription: c, sorting: l, onSortingChange: u, pageSize: d, onPageSizeChange: f, pageSizeOptions: p = S, hasNextPage: v, hasPrevPage: x, onNextPage: C, onPrevPage: E, filters: D, isFiltering: O, isAmountsError: k, onRetryAmounts: A, canCreate: j = !0, isAccessRestricted: M, onCreateClick: N, onRowClick: ne, onRetry: P, headerActionContainer: F, labels: I, emptyStateTestId: L, accessRestrictedTestId: R }) {
79
+ let z = {
79
80
  ..._,
80
- ...L
81
- }, V = e === "customer", H = V ? B.columnInvoicedAmount : B.columnBilledAmount, U = V ? B.columnReceivedAmount : B.columnTotalPaidToDate, W = V ? B.columnAmountDue : B.columnBalanceDue, G = [
81
+ ...I
82
+ }, B = e === "customer", V = B ? z.columnInvoicedAmount : z.columnBilledAmount, H = B ? z.columnReceivedAmount : z.columnTotalPaidToDate, U = B ? z.columnAmountDue : z.columnBalanceDue, W = [
82
83
  {
83
84
  accessorKey: "name",
84
85
  enableSorting: !0,
85
86
  header: ({ column: e }) => /* @__PURE__ */ y(i, {
86
87
  column: e,
87
- title: B.columnName
88
+ title: z.columnName
88
89
  }),
89
90
  cell: ({ row: e }) => /* @__PURE__ */ b("div", {
90
91
  className: "ttw:flex ttw:flex-col ttw:gap-1",
@@ -101,9 +102,9 @@ function D({ mode: e, counterparts: t, isLoading: a, isError: o, errorTitle: s,
101
102
  accessorKey: "billedAmountLabel",
102
103
  header: () => /* @__PURE__ */ y("div", {
103
104
  className: "ttw:text-right",
104
- children: H
105
+ children: V
105
106
  }),
106
- cell: ({ row: e }) => /* @__PURE__ */ y(T, {
107
+ cell: ({ row: e }) => /* @__PURE__ */ y(w, {
107
108
  value: e.original.billedAmountLabel,
108
109
  isLoading: e.original.isBilledAmountLoading
109
110
  })
@@ -112,9 +113,9 @@ function D({ mode: e, counterparts: t, isLoading: a, isError: o, errorTitle: s,
112
113
  accessorKey: "receivedOrPaidAmountLabel",
113
114
  header: () => /* @__PURE__ */ y("div", {
114
115
  className: "ttw:text-right",
115
- children: U
116
+ children: H
116
117
  }),
117
- cell: ({ row: e }) => /* @__PURE__ */ y(T, {
118
+ cell: ({ row: e }) => /* @__PURE__ */ y(w, {
118
119
  value: e.original.receivedOrPaidAmountLabel,
119
120
  isLoading: e.original.isReceivedOrPaidAmountLoading
120
121
  })
@@ -123,14 +124,14 @@ function D({ mode: e, counterparts: t, isLoading: a, isError: o, errorTitle: s,
123
124
  accessorKey: "dueOrOwedAmountLabel",
124
125
  header: () => /* @__PURE__ */ y("div", {
125
126
  className: "ttw:text-right",
126
- children: W
127
+ children: U
127
128
  }),
128
- cell: ({ row: e }) => /* @__PURE__ */ y(T, {
129
+ cell: ({ row: e }) => /* @__PURE__ */ y(w, {
129
130
  value: e.original.dueOrOwedAmountLabel,
130
131
  isLoading: e.original.isDueOrOwedAmountLoading
131
132
  })
132
133
  }
133
- ], K = (e) => /* @__PURE__ */ b("div", {
134
+ ], G = (e) => /* @__PURE__ */ b("div", {
134
135
  className: "ttw:flex ttw:flex-col ttw:gap-2",
135
136
  children: [/* @__PURE__ */ b("div", {
136
137
  className: "ttw:flex ttw:flex-col ttw:gap-1",
@@ -143,17 +144,17 @@ function D({ mode: e, counterparts: t, isLoading: a, isError: o, errorTitle: s,
143
144
  })]
144
145
  }), [
145
146
  {
146
- label: H,
147
+ label: V,
147
148
  value: e.billedAmountLabel,
148
149
  isLoading: e.isBilledAmountLoading
149
150
  },
150
151
  {
151
- label: U,
152
+ label: H,
152
153
  value: e.receivedOrPaidAmountLabel,
153
154
  isLoading: e.isReceivedOrPaidAmountLoading
154
155
  },
155
156
  {
156
- label: W,
157
+ label: U,
157
158
  value: e.dueOrOwedAmountLabel,
158
159
  isLoading: e.isDueOrOwedAmountLoading
159
160
  }
@@ -162,60 +163,64 @@ function D({ mode: e, counterparts: t, isLoading: a, isError: o, errorTitle: s,
162
163
  children: [/* @__PURE__ */ y("span", {
163
164
  className: "ttw:text-muted-foreground",
164
165
  children: e.label
165
- }), /* @__PURE__ */ y(T, {
166
+ }), /* @__PURE__ */ y(w, {
166
167
  value: e.value,
167
168
  isLoading: e.isLoading
168
169
  })]
169
170
  }, e.label))]
170
- }), q = V ? B.customersEmptyTitle : B.vendorsEmptyTitle, J = V ? B.customersEmptyDescription : B.vendorsEmptyDescription, Y = V ? B.customersEmptyAction : B.vendorsEmptyAction, X = V ? B.customersFilterEmptyTitle : B.vendorsFilterEmptyTitle, Z = !k && !O.searchValue && !t.length && !a, Q = !(!M || N), $ = !(k || !Q), ee = !k && !a && !o && !t.length, te = Q && !ee, ne = V ? B.createButton : B.vendorsCreateButton;
171
- return N ? /* @__PURE__ */ y(g, {
172
- testId: z,
173
- title: B.accessRestrictedTitle,
174
- description: B.accessRestrictedDescription
171
+ }), K = B ? z.customersEmptyTitle : z.vendorsEmptyTitle, q = B ? z.customersEmptyDescription : z.vendorsEmptyDescription, J = B ? z.customersEmptyAction : z.vendorsEmptyAction, Y = B ? z.customersFilterEmptyTitle : z.vendorsFilterEmptyTitle, X = !O && !D.searchValue && !t.length && !a, Z = !(!j || M), Q = !(O || !Z), re = !O && !a && !o && !t.length, ie = Z && !re, ae = B ? z.createButton : z.vendorsCreateButton, $ = ie ? /* @__PURE__ */ y(n, {
172
+ onClick: N,
173
+ children: ae
174
+ }) : void 0;
175
+ return M ? /* @__PURE__ */ y(g, {
176
+ testId: R,
177
+ title: z.accessRestrictedTitle,
178
+ description: z.accessRestrictedDescription
175
179
  }) : o ? /* @__PURE__ */ y(h, {
176
180
  title: s,
177
181
  description: c,
178
- retryLabel: I ? B.errorRetry : void 0,
179
- onRetry: I
182
+ retryLabel: P ? z.errorRetry : void 0,
183
+ onRetry: P
180
184
  }) : /* @__PURE__ */ b("div", {
181
185
  className: "ttw:flex ttw:flex-col ttw:gap-4",
182
- children: [A && /* @__PURE__ */ y(E, {
183
- labels: B,
184
- onRetry: j
185
- }), /* @__PURE__ */ y(r, {
186
- columns: G,
187
- data: t,
188
- isLoading: a,
189
- sorting: l,
190
- onSortingChange: u,
191
- pageSize: d,
192
- onPageSizeChange: f,
193
- pageSizeOptions: p,
194
- hasNextPage: v,
195
- hasPrevPage: x,
196
- onNextPage: C,
197
- onPrevPage: D,
198
- showPagination: !!(a || t.length > 0 || x),
199
- onRowClick: F,
200
- rowAriaLabel: (e) => B.openRow(e.name),
201
- renderCard: K,
202
- filterComponent: /* @__PURE__ */ y(w, {
203
- labels: B,
204
- filters: O,
205
- disabled: Z,
206
- action: te ? /* @__PURE__ */ y(n, {
207
- onClick: P,
208
- children: ne
209
- }) : void 0
186
+ children: [
187
+ k && /* @__PURE__ */ y(T, {
188
+ labels: z,
189
+ onRetry: A
210
190
  }),
211
- children: /* @__PURE__ */ y(m, {
212
- testId: R,
213
- title: k ? X : q,
214
- description: k ? B.filterEmptyDescription : J,
215
- actionLabel: k ? B.filterEmptyAction : $ ? Y : void 0,
216
- onAction: k ? O.onClearAll : $ ? P : void 0
217
- })
218
- })]
191
+ /* @__PURE__ */ y(r, {
192
+ columns: W,
193
+ data: t,
194
+ isLoading: a,
195
+ sorting: l,
196
+ onSortingChange: u,
197
+ pageSize: d,
198
+ onPageSizeChange: f,
199
+ pageSizeOptions: p,
200
+ hasNextPage: v,
201
+ hasPrevPage: x,
202
+ onNextPage: C,
203
+ onPrevPage: E,
204
+ showPagination: !!(a || t.length > 0 || x),
205
+ onRowClick: ne,
206
+ rowAriaLabel: (e) => z.openRow(e.name),
207
+ renderCard: G,
208
+ filterComponent: /* @__PURE__ */ y(te, {
209
+ labels: z,
210
+ filters: D,
211
+ disabled: X,
212
+ action: F === void 0 ? $ : void 0
213
+ }),
214
+ children: /* @__PURE__ */ y(m, {
215
+ testId: L,
216
+ title: O ? Y : K,
217
+ description: O ? z.filterEmptyDescription : q,
218
+ actionLabel: O ? z.filterEmptyAction : Q ? J : void 0,
219
+ onAction: O ? D.onClearAll : Q ? N : void 0
220
+ })
221
+ }),
222
+ F && $ && ee($, F)
223
+ ]
219
224
  });
220
225
  }
221
- export { D as CounterpartsScreen, D as default };
226
+ export { E as CounterpartsScreen, E as default };
@@ -22,12 +22,12 @@ import { useProductsWidget as p } from "./useProductsWidget.js";
22
22
  import { useEffect as m } from "react";
23
23
  import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
24
24
  // ../../libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/ProductsWidget.js
25
- function v({ pageSizeOptions: n = c, screenLabels: s, formLabels: v, detailsLabels: y, deleteLabels: b, measureUnitsLabels: x, measureUnitDeleteLabels: S, messageLabels: C }) {
26
- let w = t();
25
+ function v({ pageSizeOptions: n = c, screenLabels: s, formLabels: v, detailsLabels: y, deleteLabels: b, measureUnitsLabels: x, measureUnitDeleteLabels: S, messageLabels: C, headerActionContainer: w }) {
26
+ let T = t();
27
27
  m(() => {
28
- w(o.Mounted);
29
- }, [w]);
30
- let { view: T, units: E, table: D, details: O, form: k, del: A, permissions: j, isPermissionLoading: M, isTableLoading: N, hasInitError: P, refetchWidgetInit: F, measureUnitsOpen: I, actionsSuspended: L, editForm: R, handleRowClick: z, openMeasureUnits: B, closeMeasureUnits: V, addUnitOpen: H, openAddUnit: U, closeAddUnit: W, selectAddedUnit: G, submitForm: K, confirmDelete: q } = p({
28
+ T(o.Mounted);
29
+ }, [T]);
30
+ let { view: E, units: D, table: O, details: k, form: A, del: j, permissions: M, isPermissionLoading: N, isTableLoading: P, hasInitError: F, refetchWidgetInit: I, measureUnitsOpen: L, actionsSuspended: R, editForm: z, handleRowClick: B, openMeasureUnits: V, closeMeasureUnits: H, addUnitOpen: U, openAddUnit: W, closeAddUnit: G, selectAddedUnit: K, submitForm: q, confirmDelete: J } = p({
31
31
  messageLabels: C,
32
32
  screenLabels: s,
33
33
  formLabels: v
@@ -35,27 +35,28 @@ function v({ pageSizeOptions: n = c, screenLabels: s, formLabels: v, detailsLabe
35
35
  return /* @__PURE__ */ _(h, { children: [
36
36
  /* @__PURE__ */ g(e, {}),
37
37
  /* @__PURE__ */ g(u, {
38
- products: D.rows,
39
- isLoading: N,
40
- isError: P || D.isError,
41
- sorting: D.sorting,
42
- onSortingChange: D.onSortingChange,
43
- pageSize: D.pageSize,
44
- onPageSizeChange: D.onPageSizeChange,
38
+ products: O.rows,
39
+ isLoading: P,
40
+ isError: F || O.isError,
41
+ sorting: O.sorting,
42
+ onSortingChange: O.onSortingChange,
43
+ pageSize: O.pageSize,
44
+ onPageSizeChange: O.onPageSizeChange,
45
45
  pageSizeOptions: n,
46
- hasNextPage: D.hasNextPage,
47
- hasPrevPage: D.hasPrevPage,
48
- onNextPage: D.onNextPage,
49
- onPrevPage: D.onPrevPage,
50
- filters: D.filters,
51
- isFiltering: D.isFiltering,
52
- canCreate: j.canCreate,
53
- canManageUnits: j.canCreate,
54
- isAccessRestricted: !M && !P && !j.canRead,
55
- onCreateClick: k.openCreate,
56
- onManageUnitsClick: B,
57
- onRowClick: z,
58
- onRetry: P ? F : D.onRetry,
46
+ hasNextPage: O.hasNextPage,
47
+ hasPrevPage: O.hasPrevPage,
48
+ onNextPage: O.onNextPage,
49
+ onPrevPage: O.onPrevPage,
50
+ filters: O.filters,
51
+ isFiltering: O.isFiltering,
52
+ canCreate: M.canCreate,
53
+ canManageUnits: M.canCreate,
54
+ isAccessRestricted: !N && !F && !M.canRead,
55
+ onCreateClick: A.openCreate,
56
+ onManageUnitsClick: V,
57
+ onRowClick: B,
58
+ onRetry: F ? I : O.onRetry,
59
+ headerActionContainer: w,
59
60
  labels: s,
60
61
  testIds: {
61
62
  empty: l.empty,
@@ -63,57 +64,57 @@ function v({ pageSizeOptions: n = c, screenLabels: s, formLabels: v, detailsLabe
63
64
  }
64
65
  }),
65
66
  /* @__PURE__ */ g(r, {
66
- open: T === "create",
67
+ open: E === "create",
67
68
  onOpenChange: (e) => {
68
- e || k.close();
69
+ e || A.close();
69
70
  },
70
- values: k.values,
71
- errors: k.errors,
72
- unitOptions: E.unitOptions,
73
- pricePrefix: k.pricePrefix,
74
- inProgress: k.isSubmitting || L,
75
- onChange: k.change,
76
- onSubmit: K,
77
- onCancel: k.close,
78
- onAddUnit: j.canCreate ? U : void 0,
71
+ values: A.values,
72
+ errors: A.errors,
73
+ unitOptions: D.unitOptions,
74
+ pricePrefix: A.pricePrefix,
75
+ inProgress: A.isSubmitting || R,
76
+ onChange: A.change,
77
+ onSubmit: q,
78
+ onCancel: A.close,
79
+ onAddUnit: M.canCreate ? W : void 0,
79
80
  labels: v
80
81
  }),
81
82
  /* @__PURE__ */ g(d, {
82
- open: T === "details" || T === "edit",
83
+ open: E === "details" || E === "edit",
83
84
  onOpenChange: (e) => {
84
- e || k.close();
85
+ e || A.close();
85
86
  },
86
- product: O.detailsView,
87
- isLoading: O.isLoading,
88
- isError: O.isError,
89
- onEdit: k.openEdit,
90
- onDelete: A.requestDelete,
91
- canEdit: j.canUpdate,
92
- canDelete: j.canDelete,
93
- editForm: R,
87
+ product: k.detailsView,
88
+ isLoading: k.isLoading,
89
+ isError: k.isError,
90
+ onEdit: A.openEdit,
91
+ onDelete: j.requestDelete,
92
+ canEdit: M.canUpdate,
93
+ canDelete: M.canDelete,
94
+ editForm: z,
94
95
  labels: y
95
96
  }),
96
97
  /* @__PURE__ */ g(f, {
97
- open: A.open,
98
- onOpenChange: A.onOpenChange,
99
- productName: O.productName,
100
- isDeleting: A.isDeleting || L,
101
- onConfirm: q,
102
- onCancel: A.cancel,
98
+ open: j.open,
99
+ onOpenChange: j.onOpenChange,
100
+ productName: k.productName,
101
+ isDeleting: j.isDeleting || R,
102
+ onConfirm: J,
103
+ onCancel: j.cancel,
103
104
  labels: b
104
105
  }),
105
106
  /* @__PURE__ */ g(a, {
106
- open: H,
107
- onClose: W,
108
- onCreated: G,
109
- suspended: L,
107
+ open: U,
108
+ onClose: G,
109
+ onCreated: K,
110
+ suspended: R,
110
111
  labels: x,
111
112
  messageLabels: C
112
113
  }),
113
114
  /* @__PURE__ */ g(i, {
114
- open: I,
115
- onClose: V,
116
- suspended: L,
115
+ open: L,
116
+ onClose: H,
117
+ suspended: R,
117
118
  managerLabels: x,
118
119
  deleteLabels: S,
119
120
  messageLabels: C
@@ -5,78 +5,79 @@ import { NoAccessState as h } from "../../../shared/ui/dist/lib/StatePanel/NoAcc
5
5
  import "../../../shared/ui/dist/index.js";
6
6
  import { PRODUCTS_SCREEN_LABELS_EN as g } from "./index2.js";
7
7
  import { ProductTypeBadge as _ } from "./index3.js";
8
- import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
9
- import { ListFilter as x } from "lucide-react";
8
+ import { createPortal as v } from "react-dom";
9
+ import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
10
+ import { ListFilter as S } from "lucide-react";
10
11
  // ../../libs/tesouro-embedded-components-react/products-widget/ui/dist/index4.js
11
- var S = [
12
+ var C = [
12
13
  10,
13
14
  25,
14
15
  50,
15
16
  100
16
- ], C = "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";
17
- function w({ labels: e, filters: t, action: n }) {
18
- return /* @__PURE__ */ y(f, {
17
+ ], w = "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";
18
+ function T({ labels: e, filters: t, action: n }) {
19
+ return /* @__PURE__ */ b(f, {
19
20
  className: "ttw:px-4",
20
- search: /* @__PURE__ */ y(d, {
21
+ search: /* @__PURE__ */ b(d, {
21
22
  value: t.searchValue,
22
23
  onChange: (e) => t.onSearchChange(e.target.value),
23
24
  placeholder: e.searchPlaceholder,
24
25
  "aria-label": e.searchLabel,
25
26
  className: "ttw:min-w-64"
26
27
  }),
27
- filterButton: /* @__PURE__ */ b(o, {
28
+ filterButton: /* @__PURE__ */ x(o, {
28
29
  open: t.isPopoverOpen,
29
30
  onOpenChange: (e) => {
30
31
  e || t.onPopoverClose();
31
32
  },
32
- children: [/* @__PURE__ */ y(c, {
33
+ children: [/* @__PURE__ */ b(c, {
33
34
  asChild: !0,
34
- children: /* @__PURE__ */ y(r, {
35
+ children: /* @__PURE__ */ b(r, {
35
36
  activeCount: t.activeFilterCount,
36
37
  onClick: (e) => {
37
38
  t.isPanelOpen && e.preventDefault(), t.onMenuToggle();
38
39
  },
39
40
  labels: { filters: e.filtersButton }
40
41
  })
41
- }), /* @__PURE__ */ b(s, {
42
+ }), /* @__PURE__ */ x(s, {
42
43
  align: "start",
43
44
  className: "ttw:w-56 ttw:p-0",
44
45
  children: [
45
- t.isMenuOpen && /* @__PURE__ */ b("div", {
46
+ t.isMenuOpen && /* @__PURE__ */ x("div", {
46
47
  className: "ttw:p-1",
47
- children: [/* @__PURE__ */ b("button", {
48
+ children: [/* @__PURE__ */ x("button", {
48
49
  type: "button",
49
- className: C,
50
+ className: w,
50
51
  onClick: t.onTypeFieldSelect,
51
- children: [/* @__PURE__ */ y(x, {
52
+ children: [/* @__PURE__ */ b(S, {
52
53
  className: "ttw:size-4 ttw:shrink-0 ttw:text-muted-foreground",
53
54
  "aria-hidden": !0
54
55
  }), e.filterFieldType]
55
- }), /* @__PURE__ */ b("button", {
56
+ }), /* @__PURE__ */ x("button", {
56
57
  type: "button",
57
- className: C,
58
+ className: w,
58
59
  onClick: t.onUnitFieldSelect,
59
- children: [/* @__PURE__ */ y(x, {
60
+ children: [/* @__PURE__ */ b(S, {
60
61
  className: "ttw:size-4 ttw:shrink-0 ttw:text-muted-foreground",
61
62
  "aria-hidden": !0
62
63
  }), e.filterFieldUnit]
63
64
  })]
64
65
  }),
65
- t.isTypePanelOpen && /* @__PURE__ */ y(a, {
66
+ t.isTypePanelOpen && /* @__PURE__ */ b(a, {
66
67
  options: [...t.typeOptions],
67
68
  selectedValues: [...t.selectedTypes],
68
69
  onSelectionChange: t.onTypeChange
69
70
  }),
70
- t.isUnitPanelOpen && /* @__PURE__ */ y("div", {
71
+ t.isUnitPanelOpen && /* @__PURE__ */ b("div", {
71
72
  className: "ttw:max-h-64 ttw:overflow-auto ttw:p-3",
72
- children: /* @__PURE__ */ y(l, {
73
+ children: /* @__PURE__ */ b(l, {
73
74
  value: t.selectedUnit,
74
75
  onValueChange: t.onUnitChange,
75
76
  "aria-label": e.filterFieldUnit,
76
77
  className: "ttw:flex ttw:flex-col ttw:gap-1",
77
- children: t.unitOptions.map((e) => /* @__PURE__ */ b("label", {
78
+ children: t.unitOptions.map((e) => /* @__PURE__ */ x("label", {
78
79
  className: "ttw:flex ttw:cursor-pointer ttw:items-center ttw:gap-2",
79
- children: [/* @__PURE__ */ y(u, { value: e.value }), /* @__PURE__ */ y("span", {
80
+ children: [/* @__PURE__ */ b(u, { value: e.value }), /* @__PURE__ */ b("span", {
80
81
  className: "ttw:text-xs ttw:font-medium",
81
82
  children: e.label
82
83
  })]
@@ -87,12 +88,12 @@ function w({ labels: e, filters: t, action: n }) {
87
88
  })]
88
89
  }),
89
90
  action: n,
90
- tags: /* @__PURE__ */ b(v, { children: [t.chips.map((n) => /* @__PURE__ */ y(i, {
91
+ tags: /* @__PURE__ */ x(y, { children: [t.chips.map((n) => /* @__PURE__ */ b(i, {
91
92
  label: n.label,
92
93
  variant: "default",
93
94
  labels: { remove: e.filterChipRemove },
94
95
  onDismiss: () => t.onRemoveChip(n.key)
95
- }, n.key)), t.chips.length > 0 && /* @__PURE__ */ y("button", {
96
+ }, n.key)), t.chips.length > 0 && /* @__PURE__ */ b("button", {
96
97
  type: "button",
97
98
  className: "ttw:cursor-pointer ttw:whitespace-nowrap ttw:text-xs ttw:text-muted-foreground ttw:transition-colors ttw:hover:text-foreground",
98
99
  onClick: t.onClearAll,
@@ -100,24 +101,28 @@ function w({ labels: e, filters: t, action: n }) {
100
101
  })] })
101
102
  });
102
103
  }
103
- function T({ products: r, isLoading: i, isError: a, sorting: o, onSortingChange: s, pageSize: c, onPageSizeChange: l, pageSizeOptions: u = S, hasNextPage: d, hasPrevPage: f, onNextPage: x, onPrevPage: C, filters: T, isFiltering: E, onCreateClick: D, onManageUnitsClick: O, onRowClick: k, onRetry: A, canCreate: j = !0, canManageUnits: M = !0, isAccessRestricted: N, labels: P, testIds: F }) {
104
- let I = {
104
+ function E({ products: r, isLoading: i, isError: a, sorting: o, onSortingChange: s, pageSize: c, onPageSizeChange: l, pageSizeOptions: u = C, hasNextPage: d, hasPrevPage: f, onNextPage: S, onPrevPage: w, filters: E, isFiltering: D, onCreateClick: O, onManageUnitsClick: k, onRowClick: A, onRetry: j, headerActionContainer: M, canCreate: N = !0, canManageUnits: P = !0, isAccessRestricted: F, labels: I, testIds: L }) {
105
+ let R = {
105
106
  ...g,
106
- ...P,
107
+ ...I,
107
108
  typeBadge: {
108
109
  ...g.typeBadge,
109
- ...P?.typeBadge
110
+ ...I?.typeBadge
110
111
  }
111
- }, L = !E && j, R = !i && r.length === 0 && L, z = [
112
+ }, z = !D && N, B = !i && r.length === 0 && z ? void 0 : /* @__PURE__ */ b(e, {
113
+ onClick: O,
114
+ disabled: !N,
115
+ children: R.createButton
116
+ }), V = [
112
117
  {
113
118
  accessorKey: "name",
114
119
  enableSorting: !0,
115
- header: ({ column: e }) => /* @__PURE__ */ y(n, {
120
+ header: ({ column: e }) => /* @__PURE__ */ b(n, {
116
121
  column: e,
117
- title: I.columnName
122
+ title: R.columnName
118
123
  }),
119
124
  size: 320,
120
- cell: ({ row: e }) => /* @__PURE__ */ y("span", {
125
+ cell: ({ row: e }) => /* @__PURE__ */ b("span", {
121
126
  className: "ttw:block ttw:w-74 ttw:truncate",
122
127
  children: e.original.name
123
128
  })
@@ -125,19 +130,19 @@ function T({ products: r, isLoading: i, isError: a, sorting: o, onSortingChange:
125
130
  {
126
131
  accessorKey: "type",
127
132
  size: 112,
128
- header: I.columnType,
129
- cell: ({ row: e }) => e.original.type ? /* @__PURE__ */ y(_, {
133
+ header: R.columnType,
134
+ cell: ({ row: e }) => e.original.type ? /* @__PURE__ */ b(_, {
130
135
  type: e.original.type,
131
- labels: I.typeBadge
136
+ labels: R.typeBadge
132
137
  }) : null
133
138
  },
134
139
  {
135
140
  accessorKey: "description",
136
- header: I.columnDescription,
141
+ header: R.columnDescription,
137
142
  size: 1e4,
138
- cell: ({ row: e }) => /* @__PURE__ */ y("div", {
143
+ cell: ({ row: e }) => /* @__PURE__ */ b("div", {
139
144
  className: "ttw:relative ttw:h-5 ttw:min-w-40",
140
- children: /* @__PURE__ */ y("span", {
145
+ children: /* @__PURE__ */ b("span", {
141
146
  className: "ttw:absolute ttw:inset-0 ttw:truncate",
142
147
  children: e.original.description
143
148
  })
@@ -146,30 +151,30 @@ function T({ products: r, isLoading: i, isError: a, sorting: o, onSortingChange:
146
151
  {
147
152
  accessorKey: "priceLabel",
148
153
  size: 180,
149
- header: () => /* @__PURE__ */ y("div", {
154
+ header: () => /* @__PURE__ */ b("div", {
150
155
  className: "ttw:text-right",
151
- children: I.columnPrice
156
+ children: R.columnPrice
152
157
  }),
153
- cell: ({ row: e }) => /* @__PURE__ */ b("div", {
158
+ cell: ({ row: e }) => /* @__PURE__ */ x("div", {
154
159
  className: "ttw:flex ttw:w-39 ttw:items-center ttw:justify-end ttw:gap-1 ttw:tabular-nums",
155
- children: [/* @__PURE__ */ y("span", { children: e.original.priceLabel }), e.original.unitLabel && /* @__PURE__ */ y("span", {
160
+ children: [/* @__PURE__ */ b("span", { children: e.original.priceLabel }), e.original.unitLabel && /* @__PURE__ */ b("span", {
156
161
  className: "ttw:text-muted-foreground",
157
162
  children: e.original.unitLabel
158
163
  })]
159
164
  })
160
165
  }
161
166
  ];
162
- return N ? /* @__PURE__ */ y(h, {
163
- testId: F?.accessRestricted,
164
- title: I.accessRestrictedTitle,
165
- description: I.accessRestrictedDescription
166
- }) : a ? /* @__PURE__ */ y(m, {
167
- title: I.errorTitle,
168
- description: I.errorDescription,
169
- retryLabel: A ? I.errorRetry : void 0,
170
- onRetry: A
171
- }) : /* @__PURE__ */ y(t, {
172
- columns: z,
167
+ return F ? /* @__PURE__ */ b(h, {
168
+ testId: L?.accessRestricted,
169
+ title: R.accessRestrictedTitle,
170
+ description: R.accessRestrictedDescription
171
+ }) : a ? /* @__PURE__ */ b(m, {
172
+ title: R.errorTitle,
173
+ description: R.errorDescription,
174
+ retryLabel: j ? R.errorRetry : void 0,
175
+ onRetry: j
176
+ }) : /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(t, {
177
+ columns: V,
173
178
  data: r,
174
179
  isLoading: i,
175
180
  sorting: o,
@@ -179,31 +184,27 @@ function T({ products: r, isLoading: i, isError: a, sorting: o, onSortingChange:
179
184
  pageSizeOptions: u,
180
185
  hasNextPage: d,
181
186
  hasPrevPage: f,
182
- onNextPage: x,
183
- onPrevPage: C,
184
- onRowClick: k,
185
- rowAriaLabel: (e) => I.openRow(e.name),
186
- filterComponent: /* @__PURE__ */ y(w, {
187
- labels: I,
188
- filters: T,
189
- action: /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(e, {
187
+ onNextPage: S,
188
+ onPrevPage: w,
189
+ onRowClick: A,
190
+ rowAriaLabel: (e) => R.openRow(e.name),
191
+ filterComponent: /* @__PURE__ */ b(T, {
192
+ labels: R,
193
+ filters: E,
194
+ action: /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(e, {
190
195
  variant: "outline",
191
- onClick: O,
192
- disabled: !M,
193
- children: I.manageUnitsButton
194
- }), !R && /* @__PURE__ */ y(e, {
195
- onClick: D,
196
- disabled: !j,
197
- children: I.createButton
198
- })] })
196
+ onClick: k,
197
+ disabled: !P,
198
+ children: R.manageUnitsButton
199
+ }), M === void 0 && B] })
199
200
  }),
200
- children: /* @__PURE__ */ y(p, {
201
- testId: F?.empty,
202
- title: E ? I.filterEmptyTitle : I.emptyTitle,
203
- description: E ? I.filterEmptyDescription : I.emptyDescription,
204
- actionLabel: L ? I.emptyAction : void 0,
205
- onAction: L ? D : void 0
201
+ children: /* @__PURE__ */ b(p, {
202
+ testId: L?.empty,
203
+ title: D ? R.filterEmptyTitle : R.emptyTitle,
204
+ description: D ? R.filterEmptyDescription : R.emptyDescription,
205
+ actionLabel: z ? R.emptyAction : void 0,
206
+ onAction: z ? O : void 0
206
207
  })
207
- });
208
+ }), M && B && v(B, M)] });
208
209
  }
209
- export { T as ProductsScreen, T as default };
210
+ export { E as ProductsScreen, E as default };
@@ -1,5 +1,5 @@
1
1
  // ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.11.102", n = "685b2feff63e5b2a00782695f9cc64564551a5e3", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.11.105", n = "20076f918051af1eaa31384fecd8fdbbc3a68b9d", 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.11.102",
3
+ "version": "0.11.105",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": [