@tesouro/embedded-components-react 0.2.281 → 0.2.283

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 (52) hide show
  1. package/dist/index.css +17 -6
  2. package/dist/index.js +1 -1
  3. package/dist/lib/BillPayWidget.js +1 -1
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +9 -5
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +42 -39
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +69 -54
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +21 -2
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +46 -41
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +81 -1
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +46 -47
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +3 -11
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +2 -8
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +5 -3
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +43 -5
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +1 -102
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +11 -3
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +9 -6
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +4 -5
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +127 -76
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +6 -6
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +7 -112
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +85 -1
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +16 -12
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +2 -24
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +8 -0
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +114 -0
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +1 -0
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +25 -0
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +50 -49
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +1 -1
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +25 -12
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +86 -69
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +2 -1
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +7 -7
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +17 -16
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +1 -0
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +1 -1
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +89 -124
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +2 -1
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +31 -26
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +1 -1
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +80 -77
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index36.js +20 -4
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index37.js +228 -6
  45. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsList.js +4 -4
  46. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsListRow.js +13 -15
  47. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +6 -6
  48. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js +53 -11
  49. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  50. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index5.js +1 -1
  51. package/dist/packages/shared-ui-shadcn/dist/index.js +3445 -3413
  52. package/package.json +1 -1
@@ -9,126 +9,143 @@ import { useReplacePayableLineItemsMutation as n } from "../../data-access/dist/
9
9
  import { useCreatePayableMutation as r, useSubmitPayableForApprovalMutation as i, useUpdatePayableMutation as a, useValidatePayableMutation as o } from "../../data-access/dist/index7.js";
10
10
  import "../../data-access/dist/index.js";
11
11
  import { mapBillFormToPayload as s, mapLineItemsToPayload as c } from "./index6.js";
12
- import { validateBillTotals as l, validateLineItems as u } from "./index7.js";
13
- import { useCallback as d, useRef as f, useState as p } from "react";
12
+ import { validateBillCompleteness as l, validateBillTotals as u, validateLineItems as d } from "./index7.js";
13
+ import { useCallback as f, useRef as p, useState as m } from "react";
14
14
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js
15
- var m = {
15
+ var h = {
16
16
  document_id: "invoiceNumber",
17
17
  issued_at: "invoiceDate",
18
- due_date: "dueDate"
18
+ due_date: "dueDate",
19
+ counterpart_id: "vendor"
19
20
  };
20
- function h(e) {
21
+ function g(e) {
21
22
  return e.type === "type_error.none.not_allowed" || e.msg === "none is not an allowed value";
22
23
  }
23
- function g(e, n = t) {
24
+ function _(e, n = t) {
24
25
  let r = {}, i = [];
25
26
  for (let t of e) {
26
- let e = t.loc[0] ?? n.unknownValidationField, a = m[e], o = h(t) ? n.requiredField : t.msg;
27
+ let e = t.loc[0] ?? n.unknownValidationField, a = h[e], o = g(t) ? n.requiredField : t.msg;
27
28
  a ? r[a] = o : i.push(n.unmappedValidationError(e, o));
28
29
  }
29
30
  return i.length && (r.form = i.join(" ")), r;
30
31
  }
31
- function _({ payableId: m, form: h, counterpartId: _, onSaved: v, onPayableCreated: y, onDraftSaved: b, onFinalized: x, labels: S }) {
32
- let C = {
32
+ function v(e, t) {
33
+ if (!e && !t) return;
34
+ let n = {}, r = /* @__PURE__ */ new Set([...Object.keys(e ?? {}), ...Object.keys(t ?? {})]);
35
+ for (let i of r) n[i] = {
36
+ ...e?.[i],
37
+ ...t?.[i]
38
+ };
39
+ return n;
40
+ }
41
+ function y({ payableId: h, form: g, counterpartId: y, onSaved: b, onPayableCreated: x, onDraftSaved: S, onFinalized: C, labels: w }) {
42
+ let T = {
33
43
  ...t,
34
- ...S
35
- }, [w, T] = p(), E = m ?? w, [D, O] = p(), k = f(!1), A = r(), j = a(), M = n(), N = o(), P = i(), F = d(() => {
36
- let e = u(h.lineItems, C), t = l(h.discount, h.tax, h.totalOverride, C);
37
- return h.setLineItemErrors(e), !e && !t || (h.setErrors(e ? { form: C.lineItemsNeedAttention } : t), !1);
38
- }, [h, C]), I = d(async () => {
44
+ ...w
45
+ }, [E, D] = m(), O = h ?? E, [k, A] = m(), j = p(!1), M = r(), N = a(), P = n(), F = o(), I = i(), L = f(() => {
46
+ let t = d(g.lineItems, T), n = u(g.discount, g.tax, g.totalOverride, T);
47
+ return g.setLineItemErrors(t), !t && !n || (t ? (g.setErrors(void 0), e.error(T.lineItemsNeedAttention)) : g.setErrors(n), !1);
48
+ }, [g, T]), R = f(async () => {
39
49
  let e = s({
40
- values: h.values,
41
- counterpartId: _,
42
- editedTotals: h.isTotalsDirty ? {
43
- discount: h.discount,
44
- tax: h.tax,
45
- total: h.totalOverride
50
+ values: g.values,
51
+ counterpartId: y,
52
+ editedTotals: g.isTotalsDirty ? {
53
+ discount: g.discount,
54
+ tax: g.tax,
55
+ total: g.totalOverride
46
56
  } : void 0
47
- }), t = E;
48
- if (t ? await j.mutateAsync({
57
+ }), t = O;
58
+ if (t ? await N.mutateAsync({
49
59
  path: { payable_id: t },
50
60
  body: e
51
- }) : (t = (await A.mutateAsync({ body: e }))?.id, t && (T(t), y?.(t))), !t) throw Error("Payable was created without an id");
52
- return await M.mutateAsync({
61
+ }) : (t = (await M.mutateAsync({ body: e }))?.id, t && (D(t), x?.(t))), !t) throw Error("Payable was created without an id");
62
+ return await P.mutateAsync({
53
63
  path: { payable_id: t },
54
- body: { data: c(h.lineItems) }
64
+ body: { data: c(g.lineItems) }
55
65
  }), t;
56
66
  }, [
57
- _,
58
- A,
59
- h.discount,
60
- h.isTotalsDirty,
61
- h.lineItems,
62
- h.tax,
63
- h.totalOverride,
64
- h.values,
65
67
  y,
66
- E,
67
68
  M,
68
- j
69
+ g.discount,
70
+ g.isTotalsDirty,
71
+ g.lineItems,
72
+ g.tax,
73
+ g.totalOverride,
74
+ g.values,
75
+ x,
76
+ O,
77
+ P,
78
+ N
69
79
  ]);
70
80
  return {
71
- saveDraft: d(async () => {
72
- if (!k.current && F()) {
73
- k.current = !0, O("draft");
81
+ saveDraft: f(async () => {
82
+ if (!j.current && L()) {
83
+ j.current = !0, A("draft");
74
84
  try {
75
- let t = await I();
76
- h.setErrors(void 0), v?.(t), b?.(t), e.success(C.draftSaved);
85
+ let t = await R();
86
+ g.setErrors(void 0), b?.(t), S?.(t), e.success(T.draftSaved);
77
87
  } catch {
78
- h.setErrors({ form: C.saveFailed });
88
+ g.setErrors({ form: T.saveFailed });
79
89
  } finally {
80
- O(void 0), k.current = !1;
90
+ A(void 0), j.current = !1;
81
91
  }
82
92
  }
83
93
  }, [
84
- h,
85
- F,
86
- C.draftSaved,
87
- C.saveFailed,
94
+ g,
95
+ L,
96
+ T.draftSaved,
97
+ T.saveFailed,
98
+ S,
88
99
  b,
89
- v,
90
- I
100
+ R
91
101
  ]),
92
- finalize: d(async () => {
93
- if (!k.current && F()) {
94
- k.current = !0, O("finalize");
102
+ finalize: f(async () => {
103
+ if (j.current) return;
104
+ let t = d(g.lineItems, T), n = u(g.discount, g.tax, g.totalOverride, T), { formErrors: r, lineItemErrors: i } = l(g.values, y, g.lineItems, T), a = v(i, t);
105
+ g.setLineItemErrors(a);
106
+ let o = {
107
+ ...r,
108
+ ...n
109
+ };
110
+ if (g.setErrors(Object.keys(o).length ? o : void 0), t && e.error(T.lineItemsNeedAttention), !(a || Object.keys(o).length)) {
111
+ j.current = !0, A("finalize");
95
112
  try {
96
113
  let t;
97
114
  try {
98
- t = await I();
115
+ t = await R();
99
116
  } catch {
100
- h.setErrors({ form: C.saveFailed });
117
+ g.setErrors({ form: T.saveFailed });
101
118
  return;
102
119
  }
103
- v?.(t);
120
+ b?.(t);
104
121
  try {
105
- let n = await N.mutateAsync({ path: { payable_id: t } });
122
+ let n = await F.mutateAsync({ path: { payable_id: t } });
106
123
  if (n.validation_errors.length) {
107
- h.setErrors(g(n.validation_errors, C));
124
+ g.setErrors(_(n.validation_errors, T));
108
125
  return;
109
126
  }
110
- await P.mutateAsync({ path: { payable_id: t } }), h.setErrors(void 0), x?.(t), e.success(C.billFinalized);
127
+ await I.mutateAsync({ path: { payable_id: t } }), g.setErrors(void 0), C?.(t), e.success(T.billFinalized);
111
128
  } catch {
112
- h.setErrors({ form: C.finalizeFailed });
129
+ g.setErrors({ form: T.finalizeFailed });
113
130
  }
114
131
  } finally {
115
- O(void 0), k.current = !1;
132
+ A(void 0), j.current = !1;
116
133
  }
117
134
  }
118
135
  }, [
119
- h,
120
- F,
136
+ y,
137
+ g,
138
+ T,
121
139
  C,
122
- x,
123
- v,
140
+ b,
141
+ R,
124
142
  I,
125
- P,
126
- N
143
+ F
127
144
  ]),
128
- payableId: E,
129
- isSavingDraft: D === "draft",
130
- isFinalizing: D === "finalize"
145
+ payableId: O,
146
+ isSavingDraft: k === "draft",
147
+ isFinalizing: k === "finalize"
131
148
  };
132
149
  }
133
150
  //#endregion
134
- export { g as mapValidationErrorsToForm, _ as useBillCreateController };
151
+ export { _ as mapValidationErrorsToForm, y as useBillCreateController };
@@ -30,7 +30,8 @@ function n({ payable: n, lineItems: r }) {
30
30
  values: i,
31
31
  lineItems: a.length ? a : [e()],
32
32
  discount: t(n.discount),
33
- tax: t(n.tax_amount)
33
+ tax: t(n.tax_amount),
34
+ total: t(n.total_amount)
34
35
  };
35
36
  }
36
37
  //#endregion
@@ -28,16 +28,16 @@ import "./index32.js";
28
28
  import "./index33.js";
29
29
  import "./index34.js";
30
30
  import "./index35.js";
31
- import "./index36.js";
32
- import "./index37.js";
33
- import { BillsScreen as r } from "./index38.js";
31
+ import { BILL_DETAILS_SHEET_LABELS_EN as r } from "./index36.js";
32
+ import { BillDetailsSheet as i } from "./index37.js";
33
+ import { BillsScreen as a } from "./index38.js";
34
34
  import "./index39.js";
35
- import { BillUploadStatusTray as i } from "./index41.js";
35
+ import { BillUploadStatusTray as o } from "./index41.js";
36
36
  import "./index43.js";
37
37
  import "./index44.js";
38
- import { ExtractionNotice as a } from "./index45.js";
38
+ import { ExtractionNotice as s } from "./index45.js";
39
39
  import "./index46.js";
40
40
  import "./index47.js";
41
- import { SourceDocumentPanel as o } from "./index48.js";
41
+ import { SourceDocumentPanel as c } from "./index48.js";
42
42
  import "./index49.js";
43
- export { e as AddBillDialog, t as BillCreateScreen, n as BillPayWidgetUi, i as BillUploadStatusTray, r as BillsScreen, a as ExtractionNotice, o as SourceDocumentPanel };
43
+ export { e as AddBillDialog, r as BILL_DETAILS_SHEET_LABELS_EN, t as BillCreateScreen, i as BillDetailsSheet, n as BillPayWidgetUi, o as BillUploadStatusTray, a as BillsScreen, s as ExtractionNotice, c as SourceDocumentPanel };
@@ -3,44 +3,45 @@ import { BILL_FORM_FIELDS_LABELS_EN as n } from "./index12.js";
3
3
  import { useId as r } from "react";
4
4
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
5
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js
6
- function o({ values: o, errors: s, onChange: c, testId: l, labels: u }) {
7
- let d = {
6
+ function o({ values: o, errors: s, onChange: c, disabled: l, testId: u, labels: d }) {
7
+ let f = {
8
8
  ...n,
9
- ...u
10
- }, f = r(), p = (n, r, l) => {
11
- let u = `${f}-${n}`, d = `${u}-error`, p = s?.[n];
9
+ ...d
10
+ }, p = r(), m = (n, r, u) => {
11
+ let d = `${p}-${n}`, f = `${d}-error`, m = s?.[n];
12
12
  return /* @__PURE__ */ a("div", {
13
13
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
14
14
  children: [
15
15
  /* @__PURE__ */ i(t, {
16
- htmlFor: u,
16
+ htmlFor: d,
17
17
  children: r
18
18
  }),
19
19
  /* @__PURE__ */ i(e, {
20
- id: u,
21
- type: l,
20
+ id: d,
21
+ type: u,
22
22
  value: o[n],
23
- "aria-invalid": p ? !0 : void 0,
24
- "aria-describedby": p ? d : void 0,
23
+ disabled: l,
24
+ "aria-invalid": m ? !0 : void 0,
25
+ "aria-describedby": m ? f : void 0,
25
26
  onChange: (e) => c({ [n]: e.target.value })
26
27
  }),
27
- p ? /* @__PURE__ */ i("p", {
28
- id: d,
28
+ m ? /* @__PURE__ */ i("p", {
29
+ id: f,
29
30
  className: "ttw:text-sm ttw:text-destructive",
30
- children: p
31
+ children: m
31
32
  }) : null
32
33
  ]
33
34
  });
34
35
  };
35
36
  return /* @__PURE__ */ a("div", {
36
37
  className: "ttw:flex ttw:flex-col ttw:gap-4",
37
- "data-testid": l,
38
+ "data-testid": u,
38
39
  children: [/* @__PURE__ */ a("div", {
39
40
  className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
40
- children: [p("invoiceDate", d.invoiceDate, "date"), p("dueDate", d.dueDate, "date")]
41
+ children: [m("invoiceDate", f.invoiceDate, "date"), m("dueDate", f.dueDate, "date")]
41
42
  }), /* @__PURE__ */ a("div", {
42
43
  className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
43
- children: [p("invoiceNumber", d.invoiceNumber), p("poNumber", d.poNumber)]
44
+ children: [m("invoiceNumber", f.invoiceNumber), m("poNumber", f.poNumber)]
44
45
  })]
45
46
  });
46
47
  }
@@ -86,6 +86,7 @@ function y({ items: y, glCodeOptions: b, discount: x, onDiscountChange: S, tax:
86
86
  onValueChange: (e) => d.onChange({ glCode: e }),
87
87
  children: [/* @__PURE__ */ m(l, {
88
88
  id: `${p}-gl-code`,
89
+ className: "ttw:w-full",
89
90
  "aria-invalid": S("glCode") ? !0 : void 0,
90
91
  "aria-describedby": S("glCode") ? x("glCode") : void 0,
91
92
  children: /* @__PURE__ */ m(u, { placeholder: M.glCodePlaceholder })
@@ -1,6 +1,6 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js
2
2
  var e = {
3
- fieldLabel: "Vendor",
3
+ fieldLabel: "Select or add vendor",
4
4
  placeholder: "Search",
5
5
  loading: "Searching vendors...",
6
6
  emptyResults: "No vendors found",
@@ -1,131 +1,96 @@
1
- import { Input as e, Skeleton as t, cn as n } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { VENDOR_SEARCH_COMBOBOX_LABELS_EN as r } from "./index21.js";
3
- import { useId as i, useState as a } from "react";
4
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
5
- import { Plus as c, Search as l } from "lucide-react";
1
+ import { Command as e, CommandGroup as t, CommandInput as n, CommandItem as r, CommandList as i, CommandSeparator as a, Label as o, Popover as s, PopoverContent as c, PopoverTrigger as l, Skeleton as u, cn as d } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { VENDOR_SEARCH_COMBOBOX_LABELS_EN as f } from "./index21.js";
3
+ import { useId as p, useState as m } from "react";
4
+ import { jsx as h, jsxs as g } from "react/jsx-runtime";
5
+ import { Plus as _, Search as v } from "lucide-react";
6
6
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js
7
- var u = 5, d = "ttw:min-h-44";
8
- function f({ query: f, onQueryChange: p, results: m, isLoading: h, onAddVendor: g, testId: _, labels: v }) {
9
- let y = {
10
- ...r,
11
- ...v
12
- }, b = i(), x = i(), [S, C] = a(!1), [w, T] = a(-1), E = h ? 0 : m.length + 1, D = S && w >= 0 ? `${x}-option-${w}` : void 0, O = (e) => {
13
- C(!1), T(-1), e();
14
- }, k = () => {
15
- C(!1), T(-1), g();
16
- }, A = () => {
17
- C(!1), T(-1);
18
- };
19
- return /* @__PURE__ */ s("div", {
7
+ var y = 5, b = "ttw:min-h-44";
8
+ function x({ query: x, onQueryChange: S, results: C, isLoading: w, onAddVendor: T, testId: E, labels: D }) {
9
+ let O = {
10
+ ...f,
11
+ ...D
12
+ }, k = p(), [A, j] = m(!1);
13
+ return /* @__PURE__ */ g("div", {
20
14
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
21
- "data-testid": _,
22
- children: [/* @__PURE__ */ o("label", {
23
- htmlFor: b,
24
- className: "ttw:text-sm ttw:font-medium",
25
- children: y.fieldLabel
26
- }), /* @__PURE__ */ s("div", {
27
- className: "ttw:relative",
28
- children: [/* @__PURE__ */ s("div", {
29
- className: "ttw:flex ttw:h-10 ttw:items-center ttw:gap-2 ttw:rounded-md ttw:border ttw:border-border ttw:bg-background ttw:px-3",
30
- children: [/* @__PURE__ */ o(l, {
31
- "aria-hidden": !0,
32
- className: "ttw:size-4 ttw:shrink-0 ttw:opacity-50"
33
- }), /* @__PURE__ */ o(e, {
34
- id: b,
35
- value: f,
36
- onChange: (e) => {
37
- C(!0), T(-1), p(e.target.value);
38
- },
39
- onFocus: () => C(!0),
40
- onBlur: A,
41
- onKeyDown: (e) => {
42
- if (e.key === "Escape") {
43
- A();
44
- return;
45
- }
46
- if (E) {
47
- if (e.key === "ArrowDown") {
48
- e.preventDefault(), C(!0), T((e) => e >= E - 1 ? 0 : e + 1);
49
- return;
50
- }
51
- if (e.key === "ArrowUp") {
52
- e.preventDefault(), C(!0), T((e) => e <= 0 ? E - 1 : e - 1);
53
- return;
54
- }
55
- e.key === "Enter" && S && w >= 0 && (e.preventDefault(), w < m.length ? O(m[w].onSelect) : k());
56
- }
57
- },
58
- placeholder: y.placeholder,
15
+ "data-testid": E,
16
+ children: [/* @__PURE__ */ h(o, {
17
+ htmlFor: k,
18
+ children: O.fieldLabel
19
+ }), /* @__PURE__ */ g(s, {
20
+ open: A,
21
+ onOpenChange: j,
22
+ children: [/* @__PURE__ */ h(l, {
23
+ asChild: !0,
24
+ children: /* @__PURE__ */ g("button", {
25
+ type: "button",
26
+ id: k,
59
27
  role: "combobox",
60
- "aria-autocomplete": "list",
61
- "aria-expanded": S,
62
- "aria-controls": S ? x : void 0,
63
- "aria-activedescendant": D,
64
- className: "ttw:h-auto ttw:border-0 ttw:p-0 ttw:shadow-none ttw:ring-0 ttw:focus-visible:ring-0"
65
- })]
66
- }), S ? /* @__PURE__ */ s("div", {
67
- id: x,
68
- role: "listbox",
69
- className: "ttw:absolute ttw:top-full ttw:left-0 ttw:z-10 ttw:mt-1 ttw:max-h-72 ttw:w-full ttw:overflow-y-auto ttw:rounded-md ttw:border ttw:border-border ttw:bg-popover ttw:p-1 ttw:shadow-md",
70
- children: [
71
- h ? /* @__PURE__ */ s("div", {
72
- className: n("ttw:flex ttw:flex-col ttw:gap-2 ttw:p-2", d),
73
- "aria-busy": "true",
74
- children: [/* @__PURE__ */ o("span", {
75
- className: "ttw:sr-only",
76
- children: y.loading
77
- }), Array.from({ length: u }).map((e, n) => /* @__PURE__ */ s("div", {
78
- className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-4 ttw:px-2 ttw:py-1.5",
79
- children: [/* @__PURE__ */ o(t, {
80
- height: 14,
81
- width: "55%"
82
- }), /* @__PURE__ */ o(t, {
83
- height: 14,
84
- width: "30%"
85
- })]
86
- }, n))]
87
- }) : m.length === 0 && f ? /* @__PURE__ */ o("div", {
88
- className: n("ttw:flex ttw:items-center ttw:justify-center ttw:py-6 ttw:text-center ttw:text-sm", d),
89
- children: y.emptyResults
90
- }) : m.length > 0 ? /* @__PURE__ */ o("div", {
91
- role: "group",
92
- children: m.map((e, t) => /* @__PURE__ */ s("button", {
93
- id: `${x}-option-${t}`,
94
- type: "button",
95
- role: "option",
96
- "aria-selected": w === t,
97
- onMouseDown: (e) => e.preventDefault(),
98
- onMouseEnter: () => T(t),
99
- onClick: () => O(e.onSelect),
100
- className: n("ttw:flex ttw:w-full ttw:items-center ttw:justify-between ttw:gap-4 ttw:rounded-sm ttw:px-2 ttw:py-1.5 ttw:text-left ttw:text-sm ttw:outline-hidden", w === t ? "ttw:bg-accent ttw:text-accent-foreground" : "ttw:text-popover-foreground"),
101
- children: [/* @__PURE__ */ o("span", {
102
- className: "ttw:text-foreground",
103
- children: e.name
104
- }), /* @__PURE__ */ o("span", {
105
- className: "ttw:text-muted-foreground",
106
- children: e.email
107
- })]
108
- }, `${e.name}:${e.email}:${t}`))
109
- }) : null,
110
- h || m.length > 0 || f ? /* @__PURE__ */ o("div", { className: "ttw:-mx-1 ttw:my-1 ttw:h-px ttw:bg-border" }) : null,
111
- /* @__PURE__ */ o("div", {
112
- role: "group",
113
- children: /* @__PURE__ */ s("button", {
114
- id: `${x}-option-${m.length}`,
115
- type: "button",
116
- role: "option",
117
- "aria-selected": w === m.length,
118
- onMouseDown: (e) => e.preventDefault(),
119
- onMouseEnter: () => T(m.length),
120
- onClick: k,
121
- className: n("ttw:flex ttw:w-full ttw:items-center ttw:gap-2 ttw:rounded-sm ttw:px-2 ttw:py-1.5 ttw:text-left ttw:text-sm ttw:text-primary ttw:outline-hidden", w === m.length ? "ttw:bg-accent" : "ttw:bg-transparent"),
122
- children: [/* @__PURE__ */ o(c, { className: "ttw:size-4 ttw:text-primary" }), y.addVendorAction]
123
- })
124
- })
125
- ]
126
- }) : null]
28
+ "aria-expanded": A,
29
+ className: "ttw:flex ttw:h-10 ttw:w-full ttw:items-center ttw:gap-2 ttw:rounded-md ttw:border ttw:border-border ttw:bg-background ttw:px-3 ttw:text-left ttw:text-sm ttw:shadow-xs ttw:outline-none ttw:focus-visible:border-ring ttw:focus-visible:ring-[3px] ttw:focus-visible:ring-ring/50",
30
+ children: [/* @__PURE__ */ h(v, {
31
+ "aria-hidden": !0,
32
+ className: "ttw:size-4 ttw:shrink-0 ttw:opacity-50"
33
+ }), /* @__PURE__ */ h("span", {
34
+ className: d("ttw:min-w-0 ttw:flex-1 ttw:truncate", !x && "ttw:text-muted-foreground"),
35
+ children: x || O.placeholder
36
+ })]
37
+ })
38
+ }), /* @__PURE__ */ h(c, {
39
+ align: "start",
40
+ className: "ttw:w-[var(--radix-popover-trigger-width)] ttw:p-0",
41
+ children: /* @__PURE__ */ g(e, {
42
+ shouldFilter: !1,
43
+ children: [/* @__PURE__ */ h(n, {
44
+ value: x,
45
+ onValueChange: S,
46
+ placeholder: O.placeholder,
47
+ "aria-label": O.placeholder
48
+ }), /* @__PURE__ */ g(i, {
49
+ className: d("ttw:max-h-72", b),
50
+ children: [
51
+ w ? /* @__PURE__ */ g("div", {
52
+ className: "ttw:flex ttw:flex-col ttw:gap-2 ttw:p-2",
53
+ "aria-busy": "true",
54
+ children: [/* @__PURE__ */ h("span", {
55
+ className: "ttw:sr-only",
56
+ children: O.loading
57
+ }), Array.from({ length: y }).map((e, t) => /* @__PURE__ */ g("div", {
58
+ className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-4 ttw:px-2 ttw:py-1.5",
59
+ children: [/* @__PURE__ */ h(u, {
60
+ height: 14,
61
+ width: "55%"
62
+ }), /* @__PURE__ */ h(u, {
63
+ height: 14,
64
+ width: "30%"
65
+ })]
66
+ }, t))]
67
+ }) : C.length === 0 && x ? /* @__PURE__ */ h("div", {
68
+ className: d("ttw:flex ttw:items-center ttw:justify-center ttw:py-6 ttw:text-center ttw:text-sm", b),
69
+ children: O.emptyResults
70
+ }) : C.length > 0 ? /* @__PURE__ */ h(t, { children: C.map((e, t) => /* @__PURE__ */ g(r, {
71
+ value: `${e.name} ${e.email} ${t}`,
72
+ onSelect: () => e.onSelect(),
73
+ children: [/* @__PURE__ */ h("span", {
74
+ className: "ttw:text-foreground",
75
+ children: e.name
76
+ }), /* @__PURE__ */ h("span", {
77
+ className: "ttw:ml-auto ttw:text-muted-foreground",
78
+ children: e.email
79
+ })]
80
+ }, `${e.name}:${e.email}:${t}`)) }) : null,
81
+ w || C.length > 0 || x ? /* @__PURE__ */ h(a, {}) : null,
82
+ /* @__PURE__ */ g(r, {
83
+ value: "__add_vendor__",
84
+ onSelect: T,
85
+ className: "ttw:sticky ttw:bottom-0 ttw:bg-popover ttw:text-primary",
86
+ children: [/* @__PURE__ */ h(_, { className: "ttw:size-4 ttw:text-primary" }), O.addVendorAction]
87
+ })
88
+ ]
89
+ })]
90
+ })
91
+ })]
127
92
  })]
128
93
  });
129
94
  }
130
95
  //#endregion
131
- export { f as VendorSearchCombobox, f as default };
96
+ export { x as VendorSearchCombobox, x as default };
@@ -6,7 +6,8 @@ import "./index23.js";
6
6
  var n = {
7
7
  heading: "Who are you paying?",
8
8
  summaryCard: e,
9
- search: t
9
+ search: t,
10
+ noVendorPlaceholder: "No vendor selected"
10
11
  };
11
12
  //#endregion
12
13
  export { n as VENDOR_SECTION_LABELS_EN };
@@ -1,48 +1,53 @@
1
1
  import { Typography as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { InlineErrorAlert as t } from "../../../shared/ui/dist/lib/InlineErrorAlert/InlineErrorAlert.js";
3
- import "../../../shared/ui/dist/index.js";
4
- import { VendorSummaryCard as n } from "./index19.js";
2
+ import { VendorSummaryCard as t } from "./index19.js";
5
3
  import "./index20.js";
6
- import { VendorSearchCombobox as r } from "./index22.js";
4
+ import { VendorSearchCombobox as n } from "./index22.js";
7
5
  import "./index23.js";
8
- import { VENDOR_SECTION_LABELS_EN as i } from "./index24.js";
9
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
+ import { VENDOR_SECTION_LABELS_EN as r } from "./index24.js";
7
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
10
8
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js
11
- function s(s) {
12
- let { onEdit: c, onClear: l, error: u, testId: d, labels: f } = s, p = {
13
- ...i,
14
- ...f,
9
+ function o(o) {
10
+ let { onEdit: s, onClear: c, error: l, testId: u, labels: d, disabled: f } = o, p = {
11
+ ...r,
12
+ ...d,
15
13
  summaryCard: {
16
- ...i.summaryCard,
17
- ...f?.summaryCard
14
+ ...r.summaryCard,
15
+ ...d?.summaryCard
18
16
  },
19
17
  search: {
20
- ...i.search,
21
- ...f?.search
18
+ ...r.search,
19
+ ...d?.search
22
20
  }
23
21
  };
24
- return /* @__PURE__ */ o("section", {
22
+ return /* @__PURE__ */ a("section", {
25
23
  className: "ttw:flex ttw:flex-col ttw:gap-3",
26
- "data-testid": d,
24
+ "data-testid": u,
27
25
  children: [
28
- /* @__PURE__ */ a(e, {
26
+ /* @__PURE__ */ i(e, {
29
27
  component: "h2",
30
28
  variant: "h6",
31
29
  className: "ttw:font-semibold",
32
30
  children: p.heading
33
31
  }),
34
- u ? /* @__PURE__ */ a(t, { children: u }) : null,
35
- s.mode === "resolved" ? /* @__PURE__ */ a(n, {
36
- summary: s.summary,
37
- onEdit: c,
38
- onClear: l,
32
+ o.mode === "resolved" ? /* @__PURE__ */ i(t, {
33
+ summary: o.summary,
34
+ onEdit: s,
35
+ onClear: c,
39
36
  labels: p.summaryCard
40
- }) : s.mode === "selecting" ? /* @__PURE__ */ a(r, {
41
- ...s.search,
37
+ }) : f ? /* @__PURE__ */ i(e, {
38
+ variant: "body2",
39
+ className: "ttw:text-muted-foreground",
40
+ children: p.noVendorPlaceholder
41
+ }) : o.mode === "selecting" ? /* @__PURE__ */ i(n, {
42
+ ...o.search,
42
43
  labels: p.search
43
- }) : s.newVendorForm
44
+ }) : o.newVendorForm,
45
+ l ? /* @__PURE__ */ i("p", {
46
+ className: "ttw:text-sm ttw:text-destructive",
47
+ children: l
48
+ }) : null
44
49
  ]
45
50
  });
46
51
  }
47
52
  //#endregion
48
- export { s as VendorSection, s as default };
53
+ export { o as VendorSection, o as default };