@tesouro/embedded-components-react 0.11.191 → 0.11.193

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.
@@ -2,7 +2,7 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { BILL_QUEUE_ORDER as e, billQueueFilters as t } from "./index5.js";
5
+ import { BillQueue as e, billQueueFilters as t } from "./index5.js";
6
6
  import { usePayablesCountQueries as n } from "../../data-access/dist/index3.js";
7
7
  import "../../data-access/dist/index.js";
8
8
  import { useMemo as r, useState as i } from "react";
@@ -10,10 +10,10 @@ import { useMemo as r, useState as i } from "react";
10
10
  function a({ enabled: a = !0, canPay: o } = {}) {
11
11
  let [s, c] = i(o);
12
12
  o !== void 0 && s !== o && c(o);
13
- let l = o ?? s, u = r(() => e.map((e) => t(e, l ?? !1)), [l]), d = n({
13
+ let l = o ?? s, u = r(() => [t(e.AssignedToMe, l ?? !1)], [l]);
14
+ return n({
14
15
  filters: u,
15
16
  enabled: a && o !== void 0
16
- });
17
- return r(() => Object.fromEntries(e.map((e, t) => [e, d[t]?.count])), [d]);
17
+ })[0]?.count;
18
18
  }
19
- export { a as useBillQueueCounts };
19
+ export { a as useAssignedToMeCount };
@@ -1,120 +1,120 @@
1
- import { AmountFilter as e, DateRangePicker as t, FilterBar as n, FilterMenuButton as r, FilterTag as ee, Input as te, MultiSelectFilter as i, Popover as a, PopoverContent as o, PopoverTrigger as s, RadioGroup as c, RadioGroupItem as l, useFilterPanel as u } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { BILLS_FILTER_BAR_LABELS_EN as d } from "./index11.js";
3
- import { BillsFilterField as f } from "./index12.js";
4
- import { useMemo as ne } from "react";
5
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
6
- import { ListFilterIcon as h } from "lucide-react";
1
+ import { AmountFilter as e, DateRangePicker as t, FilterMenuButton as n, FilterTag as ee, Input as te, MultiSelectFilter as r, Popover as i, PopoverContent as a, PopoverTrigger as o, RadioGroup as s, RadioGroupItem as c, TableToolbar as l, useFilterPanel as ne } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { BILLS_FILTER_BAR_LABELS_EN as u } from "./index11.js";
3
+ import { BillsFilterField as d } from "./index12.js";
4
+ import { useMemo as re } from "react";
5
+ import { Fragment as ie, jsx as f, jsxs as p } from "react/jsx-runtime";
6
+ import { ListFilterIcon as m } from "lucide-react";
7
7
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index13.js
8
- var g = {
8
+ var h = {
9
9
  date: "ttw:w-auto",
10
10
  status: "ttw:w-56",
11
11
  amount: "ttw:w-64",
12
12
  vendor: "ttw:w-64",
13
13
  attachment: "ttw:w-56"
14
- }, _ = {
15
- [f.Vendor]: "vendor",
16
- [f.IssueDate]: "date",
17
- [f.DueDate]: "date",
18
- [f.Status]: "status",
19
- [f.TotalAmount]: "amount",
20
- [f.AddedOn]: "date",
21
- [f.Attachment]: "attachment"
22
- }, v = [
23
- f.IssueDate,
24
- f.DueDate,
25
- f.AddedOn
14
+ }, g = {
15
+ [d.Vendor]: "vendor",
16
+ [d.IssueDate]: "date",
17
+ [d.DueDate]: "date",
18
+ [d.Status]: "status",
19
+ [d.TotalAmount]: "amount",
20
+ [d.AddedOn]: "date",
21
+ [d.Attachment]: "attachment"
22
+ }, _ = [
23
+ d.IssueDate,
24
+ d.DueDate,
25
+ d.AddedOn
26
26
  ];
27
- function y({ fields: f, activeFilterCount: y, chips: b, onRemoveChip: x, onClearAll: S, dateField: C, onDateFieldChange: w, datePresets: T, selectedDatePreset: E, dateFrom: D, dateTo: O, onDateRangeChange: k, onDatePresetChange: A, statusOptions: j, selectedStatuses: M, onStatusChange: N, amountMode: P, onAmountModeChange: F, amountMin: I, amountMax: L, onAmountMinChange: re, onAmountMaxChange: R, vendorOptions: z, selectedVendors: B, onVendorChange: V, vendorSearchValue: H, onVendorSearchChange: U, isVendorLoading: W, isVendorError: G, hasAttachment: K, onHasAttachmentChange: q, searchSlot: J, testIds: Y, labels: X, className: ie }) {
28
- let Z = ne(() => ({
29
- ...d,
27
+ function v({ fields: d, activeFilterCount: v, chips: y, onRemoveChip: b, onClearAll: x, dateField: S, onDateFieldChange: C, datePresets: w, selectedDatePreset: T, dateFrom: E, dateTo: D, onDateRangeChange: O, onDatePresetChange: k, statusOptions: A, selectedStatuses: j, onStatusChange: M, amountMode: N, onAmountModeChange: P, amountMin: F, amountMax: ae, onAmountMinChange: I, onAmountMaxChange: L, vendorOptions: R, selectedVendors: z, onVendorChange: B, vendorSearchValue: V, onVendorSearchChange: H, isVendorLoading: U, isVendorError: W, hasAttachment: G, onHasAttachmentChange: K, leadingSlot: q, searchSlot: J, testIds: Y, labels: X, className: oe }) {
28
+ let Z = re(() => ({
29
+ ...u,
30
30
  ...X,
31
31
  fields: {
32
- ...d.fields,
32
+ ...u.fields,
33
33
  ...X?.fields
34
34
  },
35
35
  filterMenuButton: {
36
- ...d.filterMenuButton,
36
+ ...u.filterMenuButton,
37
37
  ...X?.filterMenuButton
38
38
  },
39
39
  filterTag: {
40
- ...d.filterTag,
40
+ ...u.filterTag,
41
41
  ...X?.filterTag
42
42
  },
43
43
  amountFilter: {
44
- ...d.amountFilter,
44
+ ...u.amountFilter,
45
45
  ...X?.amountFilter
46
46
  },
47
47
  dateRangePicker: {
48
- ...d.dateRangePicker,
48
+ ...u.dateRangePicker,
49
49
  ...X?.dateRangePicker
50
50
  }
51
- }), [X]), Q = u(), $ = Q.activePanelId, ae = Q.isMenuOpen || !!$, oe = ($ && g[$]) ?? "ttw:w-52", se = (e) => {
51
+ }), [X]), Q = ne(), $ = Q.activePanelId, se = Q.isMenuOpen || !!$, ce = ($ && h[$]) ?? "ttw:w-52", le = (e) => {
52
52
  $ && e.preventDefault(), Q.toggleMenu();
53
- }, ce = (e) => {
53
+ }, ue = (e) => {
54
54
  e || (Q.closeMenu(), Q.closePanel());
55
- }, le = (e) => {
56
- v.includes(e) && w(e), Q.openPanel(_[e]);
57
- }, ue = K === void 0 ? "any" : K ? "has" : "none", de = (e) => {
58
- q(e === "any" ? void 0 : e === "has");
55
+ }, de = (e) => {
56
+ _.includes(e) && C(e), Q.openPanel(g[e]);
57
+ }, fe = G === void 0 ? "any" : G ? "has" : "none", pe = (e) => {
58
+ K(e === "any" ? void 0 : e === "has");
59
59
  };
60
- return /* @__PURE__ */ p(n, {
61
- className: ie,
62
- searchSlot: J,
63
- menuSlot: /* @__PURE__ */ m(a, {
64
- open: ae,
65
- onOpenChange: ce,
66
- children: [/* @__PURE__ */ p(s, {
60
+ return /* @__PURE__ */ f(l, {
61
+ className: oe,
62
+ filters: q,
63
+ action: /* @__PURE__ */ p(ie, { children: [J, /* @__PURE__ */ p(i, {
64
+ open: se,
65
+ onOpenChange: ue,
66
+ children: [/* @__PURE__ */ f(o, {
67
67
  asChild: !0,
68
- children: /* @__PURE__ */ p(r, {
68
+ children: /* @__PURE__ */ f(n, {
69
69
  size: "default",
70
- activeCount: y,
71
- onClick: se,
70
+ activeCount: v,
71
+ onClick: le,
72
72
  labels: Z.filterMenuButton,
73
73
  "data-testid": Y?.menuButton
74
74
  })
75
- }), /* @__PURE__ */ m(o, {
75
+ }), /* @__PURE__ */ p(a, {
76
76
  align: "start",
77
- className: `ttw:p-0 ${oe}`,
77
+ className: `ttw:p-0 ${ce}`,
78
78
  children: [
79
- Q.isMenuOpen ? /* @__PURE__ */ p("div", {
79
+ Q.isMenuOpen ? /* @__PURE__ */ f("div", {
80
80
  className: "ttw:p-1",
81
81
  role: "menu",
82
82
  "aria-label": Z.fieldMenuLabel,
83
- children: f.map((e) => /* @__PURE__ */ m("button", {
83
+ children: d.map((e) => /* @__PURE__ */ p("button", {
84
84
  type: "button",
85
85
  role: "menuitem",
86
86
  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",
87
- onClick: () => le(e),
88
- children: [/* @__PURE__ */ p(h, {
87
+ onClick: () => de(e),
88
+ children: [/* @__PURE__ */ f(m, {
89
89
  className: "ttw:size-4 ttw:shrink-0 ttw:text-muted-foreground",
90
90
  "aria-hidden": !0
91
91
  }), Z.fields[e]]
92
92
  }, e))
93
93
  }) : null,
94
- $ === "date" ? /* @__PURE__ */ p(t, {
95
- from: D,
96
- to: O,
97
- onRangeChange: k,
98
- selectedPreset: E,
99
- onPresetChange: A,
100
- presets: [...T],
94
+ $ === "date" ? /* @__PURE__ */ f(t, {
95
+ from: E,
96
+ to: D,
97
+ onRangeChange: O,
98
+ selectedPreset: T,
99
+ onPresetChange: k,
100
+ presets: [...w],
101
101
  labels: {
102
102
  ...Z.dateRangePicker,
103
- fieldLabel: Z.fields[C]
103
+ fieldLabel: Z.fields[S]
104
104
  }
105
105
  }) : null,
106
- $ === "status" ? /* @__PURE__ */ p(i, {
107
- options: [...j],
108
- selectedValues: [...M],
109
- onSelectionChange: N
106
+ $ === "status" ? /* @__PURE__ */ f(r, {
107
+ options: [...A],
108
+ selectedValues: [...j],
109
+ onSelectionChange: M
110
110
  }) : null,
111
- $ === "amount" ? /* @__PURE__ */ p(e, {
112
- mode: P,
113
- onModeChange: F,
114
- min: I,
115
- max: L,
116
- onMinChange: re,
117
- onMaxChange: R,
111
+ $ === "amount" ? /* @__PURE__ */ f(e, {
112
+ mode: N,
113
+ onModeChange: P,
114
+ min: F,
115
+ max: ae,
116
+ onMinChange: I,
117
+ onMaxChange: L,
118
118
  showFlowDirection: !1,
119
119
  labels: {
120
120
  ...Z.amountFilter,
@@ -122,35 +122,35 @@ function y({ fields: f, activeFilterCount: y, chips: b, onRemoveChip: x, onClear
122
122
  max: Z.amountMax
123
123
  }
124
124
  }) : null,
125
- $ === "vendor" ? /* @__PURE__ */ m("div", {
125
+ $ === "vendor" ? /* @__PURE__ */ p("div", {
126
126
  className: "ttw:flex ttw:flex-col ttw:gap-2 ttw:p-3",
127
- children: [/* @__PURE__ */ p(te, {
127
+ children: [/* @__PURE__ */ f(te, {
128
128
  type: "search",
129
129
  className: "ttw:h-8 ttw:text-xs",
130
130
  "aria-label": Z.vendorSearchLabel,
131
131
  placeholder: Z.vendorSearchPlaceholder,
132
- value: H,
133
- onChange: (e) => U(e.target.value)
134
- }), W ? /* @__PURE__ */ p("p", {
132
+ value: V,
133
+ onChange: (e) => H(e.target.value)
134
+ }), U ? /* @__PURE__ */ f("p", {
135
135
  className: "ttw:px-1 ttw:text-xs ttw:text-muted-foreground",
136
136
  children: Z.vendorLoading
137
- }) : G ? /* @__PURE__ */ p("p", {
137
+ }) : W ? /* @__PURE__ */ f("p", {
138
138
  className: "ttw:px-1 ttw:text-xs ttw:text-destructive",
139
139
  children: Z.vendorError
140
- }) : z.length === 0 ? /* @__PURE__ */ p("p", {
140
+ }) : R.length === 0 ? /* @__PURE__ */ f("p", {
141
141
  className: "ttw:px-1 ttw:text-xs ttw:text-muted-foreground",
142
142
  children: Z.vendorEmpty
143
- }) : /* @__PURE__ */ p(i, {
144
- options: [...z],
145
- selectedValues: [...B],
146
- onSelectionChange: V
143
+ }) : /* @__PURE__ */ f(r, {
144
+ options: [...R],
145
+ selectedValues: [...z],
146
+ onSelectionChange: B
147
147
  })]
148
148
  }) : null,
149
- $ === "attachment" ? /* @__PURE__ */ p("div", {
149
+ $ === "attachment" ? /* @__PURE__ */ f("div", {
150
150
  className: "ttw:p-3",
151
- children: /* @__PURE__ */ p(c, {
152
- value: ue,
153
- onValueChange: de,
151
+ children: /* @__PURE__ */ f(s, {
152
+ value: fe,
153
+ onValueChange: pe,
154
154
  "aria-label": Z.attachmentLabel,
155
155
  className: "ttw:flex ttw:flex-col ttw:gap-1",
156
156
  children: [
@@ -166,9 +166,9 @@ function y({ fields: f, activeFilterCount: y, chips: b, onRemoveChip: x, onClear
166
166
  value: "none",
167
167
  label: Z.attachmentNone
168
168
  }
169
- ].map(({ value: e, label: t }) => /* @__PURE__ */ m("label", {
169
+ ].map(({ value: e, label: t }) => /* @__PURE__ */ p("label", {
170
170
  className: "ttw:flex ttw:cursor-pointer ttw:items-center ttw:gap-2",
171
- children: [/* @__PURE__ */ p(l, { value: e }), /* @__PURE__ */ p("span", {
171
+ children: [/* @__PURE__ */ f(c, { value: e }), /* @__PURE__ */ f("span", {
172
172
  className: "ttw:text-xs ttw:font-medium",
173
173
  children: t
174
174
  })]
@@ -177,24 +177,24 @@ function y({ fields: f, activeFilterCount: y, chips: b, onRemoveChip: x, onClear
177
177
  }) : null
178
178
  ]
179
179
  })]
180
- }),
181
- activeChipsSlot: b.length > 0 ? /* @__PURE__ */ m("span", {
180
+ })] }),
181
+ tags: y.length > 0 ? /* @__PURE__ */ p("span", {
182
182
  className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:gap-2",
183
183
  "data-testid": Y?.chips,
184
- children: [b.map((e) => /* @__PURE__ */ p(ee, {
184
+ children: [y.map((e) => /* @__PURE__ */ f(ee, {
185
185
  label: e.label,
186
186
  labels: Z.filterTag,
187
- onDismiss: () => x(e.key)
188
- }, e.key)), /* @__PURE__ */ p("button", {
187
+ onDismiss: () => b(e.key)
188
+ }, e.key)), /* @__PURE__ */ f("button", {
189
189
  type: "button",
190
190
  className: "ttw:cursor-pointer ttw:whitespace-nowrap ttw:text-xs ttw:text-muted-foreground ttw:transition-colors ttw:hover:text-foreground",
191
- onClick: S,
191
+ onClick: x,
192
192
  children: Z.clearAll
193
193
  })]
194
194
  }) : void 0
195
195
  });
196
196
  }
197
- function b(e) {
198
- return /* @__PURE__ */ p(y, { ...e }, e.fields.join("|"));
197
+ function y(e) {
198
+ return /* @__PURE__ */ f(v, { ...e }, e.fields.join("|"));
199
199
  }
200
- export { b as BillsFilterBar, b as default };
200
+ export { y as BillsFilterBar, y as default };
@@ -35,7 +35,7 @@ var a = ".pdf,.png,.jpg,.jpeg,.doc,.docx", o = {
35
35
  vendorUnavailable: "Vendor unavailable",
36
36
  searchPlaceholder: "Search by vendor name",
37
37
  searchLabel: "Search bills by vendor name",
38
- filterTabsLabel: "Filter bills by status",
38
+ filterTabsLabel: "Bill views",
39
39
  filteredEmptyTitle: "No bills match",
40
40
  filteredEmptyDescription: "Try a different search or status filter.",
41
41
  errorTitle: "Couldn't load bills",