@tesouro/embedded-components-react 0.11.235 → 0.11.236

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 (75) hide show
  1. package/README.md +2 -2
  2. package/dist/index.css +12 -0
  3. package/dist/index.d.ts +24 -0
  4. package/dist/lib/ReceivablesWidget.d.ts +24 -0
  5. package/dist/lib/WidgetSuite.d.ts +24 -0
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index.js +6 -6
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index31.js +198 -118
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +76 -194
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js +67 -75
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index34.js +111 -69
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js +459 -108
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js +101 -449
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index37.js +9 -117
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index38.js +85 -8
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index39.js +67 -73
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index40.js +246 -71
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index41.js +40 -251
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index42.js +237 -38
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index43.js +21 -244
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index44.js +529 -21
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index45.js +4 -530
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index46.js +44 -4
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index47.js +242 -41
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index48.js +3 -245
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index49.js +5 -3
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index50.js +63 -4
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index51.js +1 -64
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillsTab.js +1 -1
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +386 -354
  30. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +1 -0
  31. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +1 -1
  32. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +1 -1
  33. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +260 -258
  34. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +219 -179
  35. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +26 -25
  36. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +15 -0
  37. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +31 -40
  38. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +18 -17
  39. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +40 -8
  40. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +30 -63
  41. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +463 -27
  42. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +15 -29
  43. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +8 -18
  44. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +18 -18
  45. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +19 -30
  46. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +15 -66
  47. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +66 -391
  48. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index43.js +148 -2
  49. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +173 -43
  50. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +3 -71
  51. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js +37 -432
  52. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +66 -188
  53. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index48.js +455 -22
  54. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index49.js +191 -5
  55. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index50.js +23 -0
  56. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +5 -265
  57. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index53.js +261 -125
  58. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index54.js +2 -27
  59. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index55.js +122 -230
  60. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index56.js +27 -3
  61. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index57.js +216 -224
  62. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index58.js +3 -30
  63. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index59.js +228 -168
  64. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index60.js +29 -21
  65. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index61.js +152 -109
  66. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index62.js +22 -2
  67. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index63.js +140 -43
  68. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index64.js +2 -0
  69. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index65.js +47 -0
  70. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/document-preview.js +1 -0
  71. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  72. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/document/documentPreview.js +122 -0
  73. package/package.json +1 -1
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index52.js +0 -1
  75. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index52.js +0 -2
@@ -1,23 +1,456 @@
1
+ import { Alert as e, AlertDescription as t, Button as n, Checkbox as r, Dialog as i, DialogContent as a, DialogDescription as o, DialogFooter as s, DialogHeader as c, DialogTitle as l, Field as u, FieldContent as d, FieldError as f, FieldLabel as p, Input as m, Label as h, Select as g, SelectContent as _, SelectItem as v, SelectTrigger as y, SelectValue as b, Separator as x, Spinner as S, TooltipProvider as ee, Typography as C, cn as w } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { RECEIVABLE_FORM_DIALOG_LABELS_EN as te } from "./index19.js";
3
+ import "./index34.js";
4
+ import { OverflowMenu as ne } from "./index35.js";
5
+ import { ReceivableFormTotals as re } from "./index46.js";
6
+ import { ReceivableNotesSection as ie } from "./index47.js";
7
+ import { useId as ae } from "react";
8
+ import { jsx as T, jsxs as E } from "react/jsx-runtime";
9
+ import { CircleAlertIcon as D, MinusIcon as O, PlusIcon as k, Trash2Icon as A, XIcon as oe } from "lucide-react";
1
10
  // ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index48.js
2
- var e = {
3
- title: "Invoice",
4
- noLogo: "No logo",
5
- billToHeading: "Bill to",
6
- detailsHeading: "Details",
7
- invoiceNumberLabel: "Invoice number",
8
- invoiceDateLabel: "Invoice date",
9
- dueDateLabel: "Due date",
10
- paymentTermsLabel: "Payment terms",
11
- purchaseOrderLabel: "PO number",
12
- pending: "Pending",
13
- descriptionColumn: "Description",
14
- quantityColumn: "Qty",
15
- priceColumn: "Price",
16
- taxableColumn: "Taxable",
17
- amountColumn: "Amount",
18
- noItems: "No items",
19
- payOnline: "Pay online",
20
- paymentQrCodeLabel: "Sample payment QR code",
21
- previewRegionLabel: "Invoice preview"
22
- };
23
- export { e as RECEIVABLE_PREVIEW_LABELS_EN };
11
+ var j = "__none__", M = "__manage__", N = "ttw:flex ttw:h-9 ttw:min-w-0 ttw:items-center ttw:rounded-md ttw:border ttw:border-input ttw:shadow-xs ttw:transition-[color,box-shadow] ttw:has-[input:focus-visible]:border-ring ttw:has-[input:focus-visible]:ring-[3px] ttw:has-[input:focus-visible]:ring-ring/50 ttw:has-[[aria-invalid=true]]:border-destructive", P = "ttw:h-full ttw:min-w-0 ttw:flex-1 ttw:bg-transparent ttw:text-right ttw:text-base ttw:outline-none ttw:placeholder:text-muted-foreground ttw:disabled:cursor-not-allowed ttw:disabled:opacity-50 ttw:md:text-sm", F = "ttw:flex ttw:items-center ttw:text-sm ttw:font-medium ttw:text-muted-foreground ttw:select-none", I = "ttw:flex ttw:size-6 ttw:shrink-0 ttw:cursor-pointer ttw:items-center ttw:justify-center ttw:rounded-sm ttw:text-muted-foreground ttw:outline-none ttw:transition-all ttw:hover:bg-accent ttw:hover:text-accent-foreground ttw:focus-visible:ring-[3px] ttw:focus-visible:ring-ring/50 ttw:disabled:pointer-events-none ttw:disabled:opacity-50";
12
+ function se({ formId: e, lineItem: t, errors: i, controls: a, focusOnMount: o, canRemove: s, unitOptions: c, currencySymbol: l, labels: u, renderProductSelector: d, onChange: f, onCommit: p, onQuantityStep: m, onManageUnits: h, onRemove: x }) {
13
+ let S = `${e}-line-${t.id}`;
14
+ return /* @__PURE__ */ E("li", {
15
+ className: "ttw:flex ttw:h-9 ttw:items-center ttw:gap-2.5",
16
+ children: [
17
+ /* @__PURE__ */ T("div", {
18
+ className: "ttw:min-w-30 ttw:flex-1",
19
+ children: d(t, {
20
+ inputId: `${S}-name`,
21
+ invalid: !!i?.name,
22
+ focusOnMount: o
23
+ })
24
+ }),
25
+ /* @__PURE__ */ E("div", {
26
+ className: w(N, "ttw:w-26 ttw:min-w-26 ttw:px-[0.3rem]"),
27
+ children: [
28
+ /* @__PURE__ */ T("button", {
29
+ type: "button",
30
+ "aria-label": u.decreaseQuantityButton,
31
+ disabled: a ? !a.canDecreaseQuantity : !1,
32
+ className: I,
33
+ onClick: () => m(-1),
34
+ children: /* @__PURE__ */ T(O, { className: "ttw:size-3.5" })
35
+ }),
36
+ /* @__PURE__ */ T("input", {
37
+ id: `${S}-quantity`,
38
+ "aria-label": u.quantityLabel,
39
+ "aria-invalid": !!i?.quantity || void 0,
40
+ type: "text",
41
+ inputMode: "decimal",
42
+ className: "ttw:h-full ttw:w-full ttw:min-w-0 ttw:bg-transparent ttw:px-0 ttw:text-center ttw:text-sm ttw:outline-none",
43
+ value: t.quantity,
44
+ onChange: (e) => f({ quantity: e.target.value }),
45
+ onBlur: () => p("quantity")
46
+ }),
47
+ /* @__PURE__ */ T("button", {
48
+ type: "button",
49
+ "aria-label": u.increaseQuantityButton,
50
+ disabled: a ? !a.canIncreaseQuantity : !1,
51
+ className: I,
52
+ onClick: () => m(1),
53
+ children: /* @__PURE__ */ T(k, { className: "ttw:size-3.5" })
54
+ })
55
+ ]
56
+ }),
57
+ /* @__PURE__ */ T("div", { children: /* @__PURE__ */ E(g, {
58
+ value: t.unit || j,
59
+ onValueChange: (e) => {
60
+ e === M ? h?.() : f({ unit: e === j ? "" : e });
61
+ },
62
+ children: [/* @__PURE__ */ T(y, {
63
+ id: `${S}-unit`,
64
+ "aria-label": u.unitLabel,
65
+ "aria-invalid": !!i?.measureUnit || void 0,
66
+ className: "ttw:w-22",
67
+ children: /* @__PURE__ */ T(b, {
68
+ className: "ttw:truncate",
69
+ placeholder: u.unitPlaceholder
70
+ })
71
+ }), /* @__PURE__ */ E(_, { children: [
72
+ h && /* @__PURE__ */ E(v, {
73
+ value: M,
74
+ className: "ttw:font-semibold ttw:text-primary ttw:hover:text-primary ttw:focus:text-primary",
75
+ children: [/* @__PURE__ */ T(k, { className: "ttw:text-primary" }), u.manageUnitsOption]
76
+ }),
77
+ /* @__PURE__ */ T(v, {
78
+ value: j,
79
+ children: u.unitNone
80
+ }),
81
+ c.map((e) => /* @__PURE__ */ T(v, {
82
+ value: e.value,
83
+ children: e.label
84
+ }, e.value))
85
+ ] })]
86
+ }) }),
87
+ /* @__PURE__ */ E("div", {
88
+ className: w(N, "ttw:w-full ttw:max-w-41 ttw:min-w-29"),
89
+ children: [/* @__PURE__ */ T("span", {
90
+ className: w(F, "ttw:pl-3"),
91
+ children: l
92
+ }), /* @__PURE__ */ T("input", {
93
+ id: `${S}-price`,
94
+ "aria-label": u.priceLabel,
95
+ "aria-invalid": !!i?.price || void 0,
96
+ type: "text",
97
+ inputMode: "decimal",
98
+ className: w(P, "ttw:pr-3 ttw:pl-2"),
99
+ value: t.price,
100
+ onChange: (e) => f({ price: e.target.value }),
101
+ onBlur: () => p("price")
102
+ })]
103
+ }),
104
+ /* @__PURE__ */ T("div", {
105
+ className: "ttw:flex ttw:w-12 ttw:min-w-12 ttw:items-center ttw:justify-center",
106
+ children: /* @__PURE__ */ T(r, {
107
+ id: `${S}-taxable`,
108
+ "aria-label": u.taxableLabel,
109
+ checked: t.taxable,
110
+ onCheckedChange: (e) => f({ taxable: e === !0 })
111
+ })
112
+ }),
113
+ s && /* @__PURE__ */ T(n, {
114
+ type: "button",
115
+ variant: "ghost",
116
+ size: "sm",
117
+ "aria-label": u.removeLineItemButton,
118
+ className: "ttw:w-10 ttw:rounded-none ttw:border-l ttw:border-border ttw:pl-4 ttw:text-muted-foreground ttw:hover:bg-transparent ttw:hover:text-destructive ttw:has-[>svg]:pr-0",
119
+ onClick: x,
120
+ children: /* @__PURE__ */ T(A, {})
121
+ })
122
+ ]
123
+ });
124
+ }
125
+ function ce({ inputId: e, discountType: t, value: n, error: r, currencySymbol: i, disabled: a, labels: o, onChange: s, onTypeChange: c, onFocus: l, onBlur: m }) {
126
+ let h = `${e}-error`, g = [{
127
+ type: "amount",
128
+ label: i,
129
+ ariaLabel: o.discountAmountOptionAriaLabel
130
+ }, {
131
+ type: "percentage",
132
+ label: o.discountPercentageOption,
133
+ ariaLabel: o.discountPercentageOptionAriaLabel
134
+ }];
135
+ return /* @__PURE__ */ E(u, {
136
+ className: "ttw:flex-col",
137
+ children: [/* @__PURE__ */ E(d, {
138
+ className: "ttw:flex-row ttw:items-center ttw:justify-end",
139
+ children: [/* @__PURE__ */ T(p, {
140
+ htmlFor: e,
141
+ className: w(r && "ttw:text-destructive"),
142
+ children: o.discountLabel
143
+ }), /* @__PURE__ */ E("div", {
144
+ className: w(N, "ttw:w-40 ttw:overflow-hidden"),
145
+ children: [/* @__PURE__ */ T("div", {
146
+ className: w(F, "ttw:items-stretch ttw:self-stretch"),
147
+ children: g.map((e) => /* @__PURE__ */ T("button", {
148
+ type: "button",
149
+ "aria-label": e.ariaLabel,
150
+ "aria-pressed": t === e.type,
151
+ disabled: a,
152
+ className: w("ttw:h-full ttw:w-9 ttw:cursor-pointer ttw:border-r ttw:border-input ttw:text-sm ttw:transition-colors ttw:disabled:pointer-events-none ttw:disabled:opacity-50", t === e.type ? "ttw:bg-primary ttw:text-primary-foreground" : "ttw:text-muted-foreground ttw:hover:bg-muted ttw:hover:text-foreground"),
153
+ onClick: () => c(e.type),
154
+ children: e.label
155
+ }, e.type))
156
+ }), /* @__PURE__ */ T("input", {
157
+ id: e,
158
+ type: "text",
159
+ inputMode: "decimal",
160
+ className: w(P, "ttw:pr-3 ttw:pl-2"),
161
+ "aria-invalid": !!r || void 0,
162
+ "aria-describedby": r ? h : void 0,
163
+ disabled: a,
164
+ value: n,
165
+ onChange: (e) => s(e.target.value),
166
+ onFocus: l,
167
+ onBlur: m
168
+ })]
169
+ })]
170
+ }), r && /* @__PURE__ */ T(f, {
171
+ id: h,
172
+ className: "ttw:text-right",
173
+ children: r
174
+ })]
175
+ });
176
+ }
177
+ function L({ open: r, onRequestClose: g, mode: _ = "create", values: v, errors: y, unitOptions: b, currencySymbol: O, lineItemControls: A, autoFocusLineItemId: j, lineItemsLoading: M, inProgress: I, customerSection: L, renderProductSelector: le, onChange: R, onLineItemChange: z, onLineItemCommit: B, onLineItemQuantityStep: V, onTaxRateCommit: H, onDiscountFocus: U, onDiscountCommit: W, totals: ue, onManageUnits: de, onAddLineItem: fe, onRemoveLineItem: G, showDueDateField: pe, billingSection: me, bankAccountSection: he, attachmentsSection: ge, preview: _e, closeDisabled: ve, cancelDisabled: ye, draftButtonLabel: K, draftDisabled: q, draftLoading: be, primaryButtonLabel: xe, primaryDisabled: Se, primaryLoading: Ce, scrollContainerRef: we, onSubmit: Te, onDraftClick: J, onPrimaryClick: Ee, onDuplicateClick: Y, onDeleteClick: X, draftMenuDisabled: De, labels: Oe }) {
178
+ let Z = {
179
+ ...te,
180
+ ...Oe
181
+ }, Q = ae(), $ = [...Y ? ["clone"] : [], ...X ? ["delete"] : []];
182
+ return /* @__PURE__ */ T(i, {
183
+ open: r,
184
+ onOpenChange: (e) => {
185
+ e || g();
186
+ },
187
+ children: /* @__PURE__ */ E(a, {
188
+ showCloseButton: !1,
189
+ fullScreen: !0,
190
+ className: "ttw:flex ttw:flex-col ttw:gap-0 ttw:overflow-hidden ttw:p-0",
191
+ onInteractOutside: (e) => e.preventDefault(),
192
+ onEscapeKeyDown: (e) => {
193
+ let t = e.target;
194
+ t instanceof Element && t.closest("[role=\"combobox\"][aria-expanded=\"true\"]") && e.preventDefault();
195
+ },
196
+ children: [/* @__PURE__ */ E(c, {
197
+ className: "ttw:w-full ttw:flex-row ttw:items-center ttw:justify-between ttw:border-b ttw:border-border ttw:px-6 ttw:pt-6 ttw:pb-7",
198
+ children: [/* @__PURE__ */ E("div", {
199
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
200
+ children: [/* @__PURE__ */ T(l, {
201
+ className: "ttw:text-xl",
202
+ children: _ === "edit" ? Z.editTitle : _ === "createRecurring" ? Z.createRecurringTitle : Z.createTitle
203
+ }), /* @__PURE__ */ T(o, {
204
+ className: w(_ === "edit" && "ttw:sr-only"),
205
+ children: _ === "edit" ? Z.editDescription : Z.createDescription
206
+ })]
207
+ }), /* @__PURE__ */ E("div", {
208
+ className: "ttw:flex ttw:items-center ttw:gap-1",
209
+ children: [$.length > 0 ? /* @__PURE__ */ T(ee, {
210
+ delayDuration: 500,
211
+ children: /* @__PURE__ */ T(ne, {
212
+ actions: $,
213
+ triggerLabel: Z.moreActionsButton,
214
+ getActionLabel: (e) => e === "clone" ? Z.duplicateButton : Z.deleteButton,
215
+ onSelect: (e) => e === "clone" ? Y?.() : X?.(),
216
+ disabledActions: I || De ? $ : void 0
217
+ })
218
+ }) : null, /* @__PURE__ */ T(n, {
219
+ type: "button",
220
+ variant: "ghost",
221
+ className: "ttw:p-2 ttw:has-[>svg]:px-2",
222
+ "aria-label": Z.closeButton,
223
+ disabled: ve,
224
+ onClick: g,
225
+ children: /* @__PURE__ */ T(oe, { className: "ttw:size-6.5" })
226
+ })]
227
+ })]
228
+ }), /* @__PURE__ */ E("div", {
229
+ className: "ttw:flex ttw:min-h-0 ttw:flex-1",
230
+ children: [/* @__PURE__ */ E("div", {
231
+ ref: we,
232
+ className: "ttw:h-full ttw:min-h-0 ttw:w-1/2 ttw:overflow-auto ttw:px-8 ttw:pt-6",
233
+ children: [/* @__PURE__ */ E("form", {
234
+ id: Q,
235
+ noValidate: !0,
236
+ className: "ttw:pb-10",
237
+ onSubmit: (e) => {
238
+ e.preventDefault(), e.stopPropagation(), Te();
239
+ },
240
+ children: [/* @__PURE__ */ T("button", {
241
+ type: "submit",
242
+ className: "ttw:sr-only",
243
+ tabIndex: -1,
244
+ "aria-hidden": "true",
245
+ disabled: q,
246
+ onClick: J
247
+ }), /* @__PURE__ */ E("div", {
248
+ className: "ttw:flex ttw:flex-col ttw:gap-8",
249
+ children: [
250
+ L,
251
+ pe && /* @__PURE__ */ T("div", {
252
+ className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
253
+ children: /* @__PURE__ */ E("div", {
254
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
255
+ children: [
256
+ /* @__PURE__ */ T(h, {
257
+ htmlFor: `${Q}-due-date`,
258
+ children: Z.dueDateLabel
259
+ }),
260
+ /* @__PURE__ */ T(m, {
261
+ id: `${Q}-due-date`,
262
+ type: "date",
263
+ value: v.dueDate,
264
+ "aria-invalid": !!y?.dueDate || void 0,
265
+ "aria-describedby": y?.dueDate ? `${Q}-due-date-error` : void 0,
266
+ onChange: (e) => R({ dueDate: e.target.value })
267
+ }),
268
+ y?.dueDate && /* @__PURE__ */ T(f, {
269
+ id: `${Q}-due-date-error`,
270
+ children: y.dueDate
271
+ })
272
+ ]
273
+ })
274
+ }),
275
+ me,
276
+ /* @__PURE__ */ E("div", {
277
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:rounded-xl ttw:border ttw:border-border ttw:p-6",
278
+ children: [
279
+ /* @__PURE__ */ E("div", {
280
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:pb-4",
281
+ children: [/* @__PURE__ */ T(C, {
282
+ variant: "h4",
283
+ children: Z.lineItemsHeading
284
+ }), /* @__PURE__ */ T(C, {
285
+ variant: "body2",
286
+ color: "muted",
287
+ className: "ttw:font-medium",
288
+ children: Z.lineItemsDescription
289
+ })]
290
+ }),
291
+ y?.lineItemsSummary?.length ? /* @__PURE__ */ E(e, {
292
+ variant: "destructive",
293
+ className: "ttw:flex ttw:mb-2",
294
+ children: [/* @__PURE__ */ T(D, {}), /* @__PURE__ */ T(t, { children: /* @__PURE__ */ T("ul", { children: y.lineItemsSummary.map((e) => /* @__PURE__ */ T("li", { children: e }, e)) }) })]
295
+ }) : null,
296
+ /* @__PURE__ */ E("ul", {
297
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5",
298
+ children: [/* @__PURE__ */ E("li", {
299
+ "aria-hidden": !0,
300
+ className: "ttw:flex ttw:h-5 ttw:items-center ttw:gap-2.5 ttw:text-sm ttw:leading-5 ttw:font-medium",
301
+ children: [
302
+ /* @__PURE__ */ T("span", {
303
+ className: "ttw:inline-flex ttw:min-w-30 ttw:flex-1 ttw:whitespace-nowrap",
304
+ children: Z.productLabel
305
+ }),
306
+ /* @__PURE__ */ T("span", {
307
+ className: "ttw:w-24 ttw:min-w-24",
308
+ children: Z.quantityLabel
309
+ }),
310
+ /* @__PURE__ */ T("span", {
311
+ className: "ttw:w-20.5 ttw:min-w-20.5",
312
+ children: Z.unitLabel
313
+ }),
314
+ /* @__PURE__ */ T("span", {
315
+ className: "ttw:w-full ttw:max-w-41 ttw:min-w-29",
316
+ children: Z.priceLabel
317
+ }),
318
+ /* @__PURE__ */ T("span", {
319
+ className: "ttw:w-12 ttw:min-w-12",
320
+ children: Z.taxableLabel
321
+ }),
322
+ v.lineItems.length > 1 && /* @__PURE__ */ T("span", { className: "ttw:w-10 ttw:min-w-10" })
323
+ ]
324
+ }), M ? /* @__PURE__ */ T("li", {
325
+ className: "ttw:flex ttw:h-9 ttw:items-center ttw:justify-center",
326
+ children: /* @__PURE__ */ T(S, { className: "ttw:size-5" })
327
+ }) : v.lineItems.map((e) => /* @__PURE__ */ T(se, {
328
+ formId: Q,
329
+ lineItem: e,
330
+ errors: y?.lineItems?.[e.id],
331
+ controls: A?.[e.id],
332
+ focusOnMount: e.id === j,
333
+ canRemove: v.lineItems.length > 1,
334
+ unitOptions: b,
335
+ currencySymbol: O,
336
+ labels: Z,
337
+ renderProductSelector: le,
338
+ onChange: (t) => z(e.id, t),
339
+ onCommit: (t) => B(e.id, t),
340
+ onQuantityStep: (t) => V(e.id, t),
341
+ onManageUnits: de,
342
+ onRemove: () => G(e.id)
343
+ }, e.id))]
344
+ }),
345
+ /* @__PURE__ */ E(n, {
346
+ type: "button",
347
+ variant: "ghost",
348
+ className: "ttw:w-fit ttw:text-primary ttw:hover:text-primary",
349
+ onClick: fe,
350
+ children: [/* @__PURE__ */ T(k, { className: "ttw:size-5 ttw:text-primary" }), Z.addLineItemButton]
351
+ }),
352
+ /* @__PURE__ */ T(ce, {
353
+ inputId: `${Q}-discount`,
354
+ discountType: v.discountType,
355
+ value: v.discount,
356
+ error: y?.discount,
357
+ currencySymbol: O,
358
+ disabled: I,
359
+ labels: Z,
360
+ onChange: (e) => R({ discount: e }),
361
+ onTypeChange: (e) => R({ discountType: e }),
362
+ onFocus: U,
363
+ onBlur: W
364
+ }),
365
+ /* @__PURE__ */ E(u, {
366
+ className: "ttw:flex-col",
367
+ children: [/* @__PURE__ */ E(d, {
368
+ className: "ttw:flex-row ttw:justify-end",
369
+ children: [/* @__PURE__ */ T(p, {
370
+ htmlFor: `${Q}-tax-rate`,
371
+ className: w(y?.taxRate && "ttw:text-destructive"),
372
+ children: Z.taxRateLabel
373
+ }), /* @__PURE__ */ E("div", {
374
+ className: w(N, "ttw:w-40"),
375
+ children: [/* @__PURE__ */ T("input", {
376
+ id: `${Q}-tax-rate`,
377
+ className: w(P, "ttw:pl-3"),
378
+ placeholder: Z.taxRatePlaceholder,
379
+ type: "text",
380
+ inputMode: "decimal",
381
+ "aria-invalid": !!y?.taxRate || void 0,
382
+ "aria-describedby": y?.taxRate ? `${Q}-tax-rate-error` : void 0,
383
+ value: v.taxRate,
384
+ onChange: (e) => R({ taxRate: e.target.value }),
385
+ onBlur: H
386
+ }), /* @__PURE__ */ T("span", {
387
+ className: w(F, "ttw:pr-3"),
388
+ children: Z.taxRateSuffix
389
+ })]
390
+ })]
391
+ }), y?.taxRate && /* @__PURE__ */ T(f, {
392
+ id: `${Q}-tax-rate-error`,
393
+ className: "ttw:text-right",
394
+ children: y.taxRate
395
+ })]
396
+ }),
397
+ /* @__PURE__ */ T(x, {}),
398
+ /* @__PURE__ */ T(re, {
399
+ totals: ue,
400
+ labels: Z
401
+ })
402
+ ]
403
+ }),
404
+ he,
405
+ /* @__PURE__ */ T(ie, {
406
+ idPrefix: Q,
407
+ openingNote: v.openingNote,
408
+ closingNote: v.closingNote,
409
+ openingNoteError: y?.openingNote,
410
+ closingNoteError: y?.closingNote,
411
+ disabled: I,
412
+ onOpeningNoteChange: (e) => R({ openingNote: e }),
413
+ onClosingNoteChange: (e) => R({ closingNote: e }),
414
+ labels: Z
415
+ }),
416
+ ge
417
+ ]
418
+ })]
419
+ }), /* @__PURE__ */ E(s, {
420
+ className: "ttw:sticky ttw:bottom-0 ttw:z-10 ttw:flex-row ttw:items-center ttw:justify-end ttw:gap-4 ttw:bg-background ttw:px-6 ttw:pt-3 ttw:pb-6",
421
+ children: [
422
+ /* @__PURE__ */ T(n, {
423
+ type: "button",
424
+ variant: "ghost",
425
+ disabled: ye,
426
+ onClick: g,
427
+ children: Z.cancelButton
428
+ }),
429
+ K && /* @__PURE__ */ T(n, {
430
+ type: "submit",
431
+ form: Q,
432
+ variant: "secondary",
433
+ loading: be,
434
+ disabled: q,
435
+ onClick: J,
436
+ children: K
437
+ }),
438
+ /* @__PURE__ */ T(n, {
439
+ type: "submit",
440
+ form: Q,
441
+ loading: Ce,
442
+ disabled: Se,
443
+ onClick: Ee,
444
+ children: xe
445
+ })
446
+ ]
447
+ })]
448
+ }), /* @__PURE__ */ T("div", {
449
+ className: "ttw:h-full ttw:min-h-0 ttw:w-1/2 ttw:overflow-auto ttw:bg-muted",
450
+ children: _e
451
+ })]
452
+ })]
453
+ })
454
+ });
455
+ }
456
+ export { L as ReceivableFormDialog, L as default };
@@ -1,7 +1,193 @@
1
- import { Fragment as e } from "react";
2
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
1
+ import { Alert as e, AlertDescription as t, Button as n, DatePicker as r, DescriptionList as i, Dialog as a, DialogContent as o, DialogFooter as s, DialogHeader as c, DialogTitle as l, FieldRequirement as u, InputGroup as d, InputGroupAddon as f, InputGroupInput as p, Label as m, Skeleton as h } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { RECEIVABLE_PAYMENT_DIALOG_LABELS_EN as g } from "./index19.js";
3
+ import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
4
+ import { TriangleAlert as b } from "lucide-react";
3
5
  // ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index49.js
4
- function r({ lines: r }) {
5
- return r.map((r, i) => /* @__PURE__ */ n(e, { children: [i > 0 && /* @__PURE__ */ t("br", {}), r] }, `${i}-${r}`));
6
+ var x = {
7
+ amount: "receivable-payment-amount",
8
+ date: "receivable-payment-date",
9
+ time: "receivable-payment-time"
10
+ };
11
+ function S({ id: e, message: t }) {
12
+ return t ? /* @__PURE__ */ v("p", {
13
+ id: e,
14
+ className: "ttw:text-sm ttw:text-destructive",
15
+ children: t
16
+ }) : null;
6
17
  }
7
- export { r as PreviewLines };
18
+ function C({ open: C, onOpenChange: w, step: T, values: E, errors: D, currencySymbol: O, amountDueLabel: k, review: A, inProgress: j, onChange: M, onFillAmountDue: N, onSave: P, onEdit: F, onConfirm: I, onCancel: L, labels: R }) {
19
+ let z = {
20
+ ...g,
21
+ ...R
22
+ };
23
+ return /* @__PURE__ */ v(a, {
24
+ open: C,
25
+ onOpenChange: w,
26
+ children: /* @__PURE__ */ v(o, {
27
+ size: T === "review" && A ? "confirm" : "form",
28
+ closeDisabled: j,
29
+ labels: { close: z.close },
30
+ "aria-describedby": void 0,
31
+ className: "ttw:flex ttw:flex-col ttw:gap-6",
32
+ children: T === "review" && A ? /* @__PURE__ */ y(_, { children: [
33
+ /* @__PURE__ */ v(c, { children: /* @__PURE__ */ v(l, { children: z.reviewTitle }) }),
34
+ /* @__PURE__ */ v(i, {
35
+ variant: "form-review",
36
+ items: [
37
+ {
38
+ label: z.amountLabel,
39
+ value: A.amountLabel
40
+ },
41
+ {
42
+ label: z.fromLabel,
43
+ value: A.fromLabel
44
+ },
45
+ {
46
+ label: z.receivedLabel,
47
+ value: A.receivedLabel
48
+ },
49
+ {
50
+ label: z.referenceLabel,
51
+ value: A.referenceLabel
52
+ },
53
+ {
54
+ label: z.createdByLabel,
55
+ value: A.isCreatedByLoading ? /* @__PURE__ */ v(h, { className: "ttw:h-4 ttw:w-24" }) : A.createdByLabel
56
+ }
57
+ ]
58
+ }),
59
+ /* @__PURE__ */ y(e, {
60
+ variant: "warning",
61
+ children: [/* @__PURE__ */ v(b, { "aria-hidden": "true" }), /* @__PURE__ */ v(t, { children: z.reviewWarning })]
62
+ }),
63
+ /* @__PURE__ */ v(s, {
64
+ start: /* @__PURE__ */ v(n, {
65
+ variant: "ghost",
66
+ disabled: j,
67
+ onClick: F,
68
+ children: z.editRecordButton
69
+ }),
70
+ children: /* @__PURE__ */ v(n, {
71
+ loading: j,
72
+ onClick: I,
73
+ children: z.confirmButton
74
+ })
75
+ })
76
+ ] }) : /* @__PURE__ */ y("form", {
77
+ className: "ttw:flex ttw:flex-col ttw:gap-6",
78
+ noValidate: !0,
79
+ onSubmit: (e) => {
80
+ e.preventDefault(), P();
81
+ },
82
+ children: [
83
+ /* @__PURE__ */ v(c, { children: /* @__PURE__ */ v(l, { children: z.title }) }),
84
+ /* @__PURE__ */ y("div", {
85
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
86
+ children: [
87
+ /* @__PURE__ */ v(m, {
88
+ htmlFor: x.amount,
89
+ requirement: u.Required,
90
+ children: z.amountLabel
91
+ }),
92
+ /* @__PURE__ */ y(d, { children: [/* @__PURE__ */ v(p, {
93
+ id: x.amount,
94
+ type: "number",
95
+ required: !0,
96
+ placeholder: z.amountPlaceholder,
97
+ "data-has-end-addon": !0,
98
+ "aria-invalid": !!D?.amount || void 0,
99
+ "aria-describedby": D?.amount ? `${x.amount}-error` : void 0,
100
+ value: E.amount,
101
+ onChange: (e) => M({ amount: e.target.value })
102
+ }), /* @__PURE__ */ v(f, {
103
+ align: "inline-end",
104
+ children: O
105
+ })] }),
106
+ /* @__PURE__ */ v(S, {
107
+ id: `${x.amount}-error`,
108
+ message: D?.amount
109
+ }),
110
+ /* @__PURE__ */ y("p", {
111
+ className: "ttw:text-sm ttw:text-muted-foreground",
112
+ children: [
113
+ z.fullAmountDuePrefix,
114
+ " ",
115
+ /* @__PURE__ */ v(n, {
116
+ type: "button",
117
+ variant: "link",
118
+ className: "ttw:h-auto ttw:p-0 ttw:underline",
119
+ onClick: N,
120
+ children: k
121
+ })
122
+ ]
123
+ })
124
+ ]
125
+ }),
126
+ /* @__PURE__ */ y("div", {
127
+ className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
128
+ children: [/* @__PURE__ */ y("div", {
129
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
130
+ children: [
131
+ /* @__PURE__ */ v(m, {
132
+ htmlFor: x.date,
133
+ requirement: u.Required,
134
+ children: z.dateLabel
135
+ }),
136
+ /* @__PURE__ */ v(r, {
137
+ id: x.date,
138
+ value: E.paymentDate,
139
+ onChange: (e) => M({ paymentDate: e }),
140
+ placeholder: z.datePlaceholder,
141
+ iconPosition: "end",
142
+ "aria-invalid": !!D?.paymentDate || void 0,
143
+ "aria-describedby": D?.paymentDate ? `${x.date}-error` : void 0
144
+ }),
145
+ /* @__PURE__ */ v(S, {
146
+ id: `${x.date}-error`,
147
+ message: D?.paymentDate
148
+ })
149
+ ]
150
+ }), /* @__PURE__ */ y("div", {
151
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
152
+ children: [
153
+ /* @__PURE__ */ v(m, {
154
+ htmlFor: x.time,
155
+ requirement: u.Required,
156
+ children: z.timeLabel
157
+ }),
158
+ /* @__PURE__ */ y(d, { children: [/* @__PURE__ */ v(p, {
159
+ id: x.time,
160
+ type: "time",
161
+ required: !0,
162
+ "data-has-end-addon": !0,
163
+ "aria-invalid": !!D?.paymentTime || void 0,
164
+ "aria-describedby": D?.paymentTime ? `${x.time}-error` : void 0,
165
+ value: E.paymentTime,
166
+ onChange: (e) => M({ paymentTime: e.target.value })
167
+ }), /* @__PURE__ */ v(f, {
168
+ align: "inline-end",
169
+ children: z.timeZoneSuffix
170
+ })] }),
171
+ /* @__PURE__ */ v(S, {
172
+ id: `${x.time}-error`,
173
+ message: D?.paymentTime
174
+ })
175
+ ]
176
+ })]
177
+ }),
178
+ /* @__PURE__ */ y(s, { children: [/* @__PURE__ */ v(n, {
179
+ type: "button",
180
+ variant: "ghost",
181
+ onClick: L,
182
+ children: z.cancelButton
183
+ }), /* @__PURE__ */ v(n, {
184
+ type: "submit",
185
+ loading: j,
186
+ children: z.saveButton
187
+ })] })
188
+ ]
189
+ })
190
+ })
191
+ });
192
+ }
193
+ export { C as ReceivablePaymentDialog, C as default };