@tesouro/embedded-components-react 0.5.268 → 0.5.271

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 (60) hide show
  1. package/dist/index.css +4 -10
  2. package/dist/index.d.ts +13 -9
  3. package/dist/lib/ReceivablesWidget.d.ts +13 -9
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index2.js +22 -18
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index14.js +8 -4
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/invalidation.js +3 -3
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/lib/invalidatePayableQueries/reconcileSubmittedForApprovalQueries.js +1 -1
  8. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index.js +3 -1
  9. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsContainer.js +44 -0
  10. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsSheetView.js +97 -0
  11. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsWidget.js +76 -150
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +63 -57
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/actionsModal.js +1 -1
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/auditHistory/labels.js +1 -1
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js +161 -152
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +30 -34
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +12 -8
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/statusCards.js +18 -19
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +208 -158
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +91 -85
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +197 -196
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +147 -115
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +14 -14
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +3 -5
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +37 -34
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +22 -7
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +17 -15
  28. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +17 -13
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +37 -31
  30. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +29 -23
  31. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +38 -11
  32. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +26 -28
  33. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +20 -14
  34. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +8 -24
  35. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +34 -83
  36. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +14 -404
  37. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +28 -2
  38. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +79 -39
  39. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +490 -68
  40. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +2 -502
  41. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +41 -216
  42. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +70 -21
  43. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +484 -5
  44. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +224 -0
  45. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index43.js +21 -263
  46. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +8 -2
  47. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js +261 -24
  48. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +2 -237
  49. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index48.js +100 -3
  50. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index49.js +21 -242
  51. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index50.js +226 -82
  52. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +3 -59
  53. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index52.js +233 -178
  54. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index53.js +85 -37
  55. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index54.js +60 -0
  56. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index55.js +194 -0
  57. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index56.js +45 -0
  58. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  59. package/package.json +1 -1
  60. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +0 -100
@@ -1,8 +1,487 @@
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, 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, Typography as C, cn as w } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { RECEIVABLE_FORM_DIALOG_LABELS_EN as T } from "./index13.js";
3
+ import { ReceivableFormTotals as ee } from "./index39.js";
4
+ import { ReceivableNotesSection as E } from "./index40.js";
5
+ import { useId as te } from "react";
6
+ import { Fragment as ne, jsx as D, jsxs as O } from "react/jsx-runtime";
7
+ import { MinusIcon as k, PlusIcon as A, Trash2Icon as j, XIcon as re } from "lucide-react";
3
8
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js
4
- function r({ lines: r }) {
5
- return r.map((r, i) => /* @__PURE__ */ n(e, { children: [i > 0 && /* @__PURE__ */ t("br", {}), r] }, `${i}-${r}`));
9
+ var M = "__none__", N = "__manage__", P = "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", F = "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", I = "ttw:flex ttw:items-center ttw:text-sm ttw:font-medium ttw:text-muted-foreground ttw:select-none", L = "ttw:flex ttw:size-6 ttw:shrink-0 ttw:cursor-pointer ttw:items-center ttw:justify-center ttw:rounded-[calc(var(--radius)-5px)] 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";
10
+ function R({ message: e }) {
11
+ return e ? /* @__PURE__ */ D("p", {
12
+ className: "ttw:text-sm ttw:text-destructive",
13
+ children: e
14
+ }) : null;
15
+ }
16
+ function ie({ 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 }) {
17
+ let S = `${e}-line-${t.id}`;
18
+ return /* @__PURE__ */ O("li", {
19
+ className: "ttw:flex ttw:h-9 ttw:items-center ttw:gap-2.5",
20
+ children: [
21
+ /* @__PURE__ */ D("div", {
22
+ className: "ttw:min-w-30 ttw:flex-1",
23
+ children: d(t, {
24
+ inputId: `${S}-name`,
25
+ invalid: !!i?.name,
26
+ focusOnMount: o
27
+ })
28
+ }),
29
+ /* @__PURE__ */ O("div", {
30
+ className: w(P, "ttw:w-26 ttw:min-w-26 ttw:px-[0.3rem]"),
31
+ children: [
32
+ /* @__PURE__ */ D("button", {
33
+ type: "button",
34
+ "aria-label": u.decreaseQuantityButton,
35
+ disabled: a ? !a.canDecreaseQuantity : !1,
36
+ className: L,
37
+ onClick: () => m(-1),
38
+ children: /* @__PURE__ */ D(k, { className: "ttw:size-3.5" })
39
+ }),
40
+ /* @__PURE__ */ D("input", {
41
+ id: `${S}-quantity`,
42
+ "aria-label": u.quantityLabel,
43
+ "aria-invalid": !!i?.quantity || void 0,
44
+ type: "text",
45
+ inputMode: "decimal",
46
+ 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",
47
+ value: t.quantity,
48
+ onChange: (e) => f({ quantity: e.target.value }),
49
+ onBlur: () => p("quantity")
50
+ }),
51
+ /* @__PURE__ */ D("button", {
52
+ type: "button",
53
+ "aria-label": u.increaseQuantityButton,
54
+ disabled: a ? !a.canIncreaseQuantity : !1,
55
+ className: L,
56
+ onClick: () => m(1),
57
+ children: /* @__PURE__ */ D(A, { className: "ttw:size-3.5" })
58
+ })
59
+ ]
60
+ }),
61
+ /* @__PURE__ */ O(g, {
62
+ value: t.unit || M,
63
+ onValueChange: (e) => {
64
+ if (e === N) {
65
+ h?.();
66
+ return;
67
+ }
68
+ f({ unit: e === M ? "" : e });
69
+ },
70
+ children: [/* @__PURE__ */ D(y, {
71
+ id: `${S}-unit`,
72
+ "aria-label": u.unitLabel,
73
+ "aria-invalid": !!i?.measureUnit || void 0,
74
+ className: "ttw:w-22",
75
+ children: /* @__PURE__ */ D(b, {
76
+ className: "ttw:truncate",
77
+ placeholder: u.unitPlaceholder
78
+ })
79
+ }), /* @__PURE__ */ O(_, { children: [
80
+ h && /* @__PURE__ */ O(v, {
81
+ value: N,
82
+ className: "ttw:font-semibold ttw:text-primary ttw:hover:text-primary ttw:focus:text-primary",
83
+ children: [/* @__PURE__ */ D(A, { className: "ttw:text-primary" }), u.manageUnitsOption]
84
+ }),
85
+ /* @__PURE__ */ D(v, {
86
+ value: M,
87
+ children: u.unitNone
88
+ }),
89
+ c.map((e) => /* @__PURE__ */ D(v, {
90
+ value: e.value,
91
+ children: e.label
92
+ }, e.value))
93
+ ] })]
94
+ }),
95
+ /* @__PURE__ */ O("div", {
96
+ className: w(P, "ttw:w-full ttw:max-w-41 ttw:min-w-29"),
97
+ children: [/* @__PURE__ */ D("span", {
98
+ className: w(I, "ttw:pl-3"),
99
+ children: l
100
+ }), /* @__PURE__ */ D("input", {
101
+ id: `${S}-price`,
102
+ "aria-label": u.priceLabel,
103
+ "aria-invalid": !!i?.price || void 0,
104
+ type: "text",
105
+ inputMode: "decimal",
106
+ className: w(F, "ttw:pr-3 ttw:pl-2"),
107
+ value: t.price,
108
+ onChange: (e) => f({ price: e.target.value }),
109
+ onBlur: () => p("price")
110
+ })]
111
+ }),
112
+ /* @__PURE__ */ D("div", {
113
+ className: "ttw:flex ttw:w-12 ttw:min-w-12 ttw:items-center ttw:justify-center",
114
+ children: /* @__PURE__ */ D(r, {
115
+ id: `${S}-taxable`,
116
+ "aria-label": u.taxableLabel,
117
+ checked: t.taxable,
118
+ onCheckedChange: (e) => f({ taxable: e === !0 })
119
+ })
120
+ }),
121
+ s && /* @__PURE__ */ D(n, {
122
+ type: "button",
123
+ variant: "ghost",
124
+ size: "sm",
125
+ "aria-label": u.removeLineItemButton,
126
+ 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",
127
+ onClick: x,
128
+ children: /* @__PURE__ */ D(j, {})
129
+ })
130
+ ]
131
+ });
132
+ }
133
+ function ae({ inputId: e, discountType: t, value: n, error: r, currencySymbol: i, disabled: a, labels: o, onChange: s, onTypeChange: c, onFocus: l, onBlur: m }) {
134
+ let h = `${e}-error`, g = [{
135
+ type: "amount",
136
+ label: i,
137
+ ariaLabel: o.discountAmountOptionAriaLabel
138
+ }, {
139
+ type: "percentage",
140
+ label: o.discountPercentageOption,
141
+ ariaLabel: o.discountPercentageOptionAriaLabel
142
+ }];
143
+ return /* @__PURE__ */ O(u, {
144
+ className: "ttw:flex-col",
145
+ children: [/* @__PURE__ */ O(d, {
146
+ className: "ttw:flex-row ttw:items-center ttw:justify-end",
147
+ children: [/* @__PURE__ */ D(p, {
148
+ htmlFor: e,
149
+ className: w(r && "ttw:text-destructive"),
150
+ children: o.discountLabel
151
+ }), /* @__PURE__ */ O("div", {
152
+ className: w(P, "ttw:w-40 ttw:overflow-hidden"),
153
+ children: [/* @__PURE__ */ D("div", {
154
+ className: w(I, "ttw:items-stretch ttw:self-stretch"),
155
+ children: g.map((e) => /* @__PURE__ */ D("button", {
156
+ type: "button",
157
+ "aria-label": e.ariaLabel,
158
+ "aria-pressed": t === e.type,
159
+ disabled: a,
160
+ 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"),
161
+ onClick: () => c(e.type),
162
+ children: e.label
163
+ }, e.type))
164
+ }), /* @__PURE__ */ D("input", {
165
+ id: e,
166
+ type: "text",
167
+ inputMode: "decimal",
168
+ className: w(F, "ttw:pr-3 ttw:pl-2"),
169
+ "aria-invalid": !!r || void 0,
170
+ "aria-describedby": r ? h : void 0,
171
+ disabled: a,
172
+ value: n,
173
+ onChange: (e) => s(e.target.value),
174
+ onFocus: l,
175
+ onBlur: m
176
+ })]
177
+ })]
178
+ }), r && /* @__PURE__ */ D(f, {
179
+ id: h,
180
+ className: "ttw:text-right",
181
+ children: r
182
+ })]
183
+ });
184
+ }
185
+ function z({ open: r, onRequestClose: g, mode: _ = "create", values: v, errors: y, unitOptions: b, currencySymbol: k, lineItemControls: j, autoFocusLineItemId: M, lineItemsLoading: N, inProgress: L, customerSelector: z, renderProductSelector: B, onChange: V, onLineItemChange: H, onLineItemCommit: U, onLineItemQuantityStep: W, onTaxRateCommit: G, onDiscountFocus: K, onDiscountCommit: q, totals: J, onManageUnits: oe, onAddLineItem: se, onRemoveLineItem: ce, showDueDateField: le, onAddCustomerDetailsClick: Y, billingSection: ue, bankAccountSection: de, attachmentsSection: fe, preview: pe, closeDisabled: me, cancelDisabled: he, draftButtonLabel: X, draftDisabled: ge, draftLoading: _e, primaryButtonLabel: ve, primaryDisabled: ye, primaryLoading: be, scrollContainerRef: Z, onSubmit: xe, onDraftClick: Se, onPrimaryClick: Ce, labels: we }) {
186
+ let Q = {
187
+ ...T,
188
+ ...we
189
+ }, $ = te();
190
+ return /* @__PURE__ */ D(i, {
191
+ open: r,
192
+ onOpenChange: (e) => {
193
+ e || g();
194
+ },
195
+ modal: !1,
196
+ children: /* @__PURE__ */ O(a, {
197
+ fullScreen: !0,
198
+ className: "ttw:flex ttw:flex-col ttw:gap-0 ttw:overflow-hidden ttw:p-0",
199
+ onInteractOutside: (e) => e.preventDefault(),
200
+ children: [/* @__PURE__ */ O(c, {
201
+ 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",
202
+ children: [/* @__PURE__ */ O("div", {
203
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
204
+ children: [/* @__PURE__ */ D(l, {
205
+ className: "ttw:text-3xl ttw:tracking-normal",
206
+ children: _ === "edit" ? Q.editTitle : Q.createTitle
207
+ }), /* @__PURE__ */ D(o, {
208
+ className: w(_ === "edit" && "ttw:sr-only"),
209
+ children: _ === "edit" ? Q.editDescription : Q.createDescription
210
+ })]
211
+ }), /* @__PURE__ */ D(n, {
212
+ type: "button",
213
+ variant: "ghost",
214
+ className: "ttw:p-2 ttw:has-[>svg]:px-2",
215
+ "aria-label": Q.closeButton,
216
+ disabled: me,
217
+ onClick: g,
218
+ children: /* @__PURE__ */ D(re, { className: "ttw:size-6.5" })
219
+ })]
220
+ }), /* @__PURE__ */ O("div", {
221
+ className: "ttw:flex ttw:min-h-0 ttw:flex-1",
222
+ children: [/* @__PURE__ */ O("div", {
223
+ ref: Z,
224
+ className: "ttw:h-full ttw:min-h-0 ttw:w-1/2 ttw:overflow-auto ttw:px-8 ttw:pt-6",
225
+ children: [/* @__PURE__ */ O("form", {
226
+ id: $,
227
+ noValidate: !0,
228
+ className: "ttw:pb-10",
229
+ onSubmit: (e) => {
230
+ e.preventDefault(), e.stopPropagation(), xe();
231
+ },
232
+ children: [/* @__PURE__ */ D("button", {
233
+ type: "submit",
234
+ className: "ttw:sr-only",
235
+ tabIndex: -1,
236
+ "aria-hidden": "true"
237
+ }), /* @__PURE__ */ O("div", {
238
+ className: "ttw:flex ttw:flex-col ttw:gap-8",
239
+ children: [
240
+ /* @__PURE__ */ O("div", {
241
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:rounded-xl ttw:border ttw:border-border ttw:p-6",
242
+ children: [
243
+ /* @__PURE__ */ O("div", {
244
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:pb-4",
245
+ children: [/* @__PURE__ */ D(C, {
246
+ variant: "h4",
247
+ children: Q.customerHeading
248
+ }), /* @__PURE__ */ D(C, {
249
+ variant: "body2",
250
+ color: "muted",
251
+ className: "ttw:font-medium",
252
+ children: Q.customerDescription
253
+ })]
254
+ }),
255
+ z,
256
+ /* @__PURE__ */ D(R, { message: y?.customerId }),
257
+ !v.customerId && /* @__PURE__ */ O(ne, { children: [/* @__PURE__ */ D(u, { children: /* @__PURE__ */ O(d, { children: [
258
+ /* @__PURE__ */ D(p, {
259
+ htmlFor: `${$}-customer-email`,
260
+ children: Q.customerEmailLabel
261
+ }),
262
+ /* @__PURE__ */ D(m, {
263
+ id: `${$}-customer-email`,
264
+ type: "email",
265
+ disabled: L,
266
+ "aria-invalid": !!y?.customerEmail || void 0,
267
+ "aria-describedby": y?.customerEmail ? `${$}-customer-email-error` : void 0,
268
+ value: v.customerEmail,
269
+ onChange: (e) => V({ customerEmail: e.target.value })
270
+ }),
271
+ y?.customerEmail && /* @__PURE__ */ D(f, {
272
+ id: `${$}-customer-email-error`,
273
+ children: y.customerEmail
274
+ })
275
+ ] }) }), Y && /* @__PURE__ */ O(n, {
276
+ type: "button",
277
+ variant: "ghost",
278
+ disabled: L,
279
+ className: "ttw:w-fit ttw:text-primary ttw:hover:text-primary",
280
+ onClick: Y,
281
+ children: [/* @__PURE__ */ D(A, {}), Q.addCustomerDetailsButton]
282
+ })] })
283
+ ]
284
+ }),
285
+ le && /* @__PURE__ */ D("div", {
286
+ className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
287
+ children: /* @__PURE__ */ O("div", {
288
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
289
+ children: [
290
+ /* @__PURE__ */ D(h, {
291
+ htmlFor: `${$}-due-date`,
292
+ children: Q.dueDateLabel
293
+ }),
294
+ /* @__PURE__ */ D(m, {
295
+ id: `${$}-due-date`,
296
+ type: "date",
297
+ value: v.dueDate,
298
+ onChange: (e) => V({ dueDate: e.target.value })
299
+ }),
300
+ /* @__PURE__ */ D(R, { message: y?.dueDate })
301
+ ]
302
+ })
303
+ }),
304
+ ue,
305
+ /* @__PURE__ */ O("div", {
306
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:rounded-xl ttw:border ttw:border-border ttw:p-6",
307
+ children: [
308
+ /* @__PURE__ */ O("div", {
309
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:pb-4",
310
+ children: [/* @__PURE__ */ D(C, {
311
+ variant: "h4",
312
+ children: Q.lineItemsHeading
313
+ }), /* @__PURE__ */ D(C, {
314
+ variant: "body2",
315
+ color: "muted",
316
+ className: "ttw:font-medium",
317
+ children: Q.lineItemsDescription
318
+ })]
319
+ }),
320
+ y?.lineItemsSummary?.length ? /* @__PURE__ */ D(e, {
321
+ variant: "destructive",
322
+ className: "ttw:mb-2",
323
+ children: /* @__PURE__ */ D(t, { children: /* @__PURE__ */ D("ul", { children: y.lineItemsSummary.map((e) => /* @__PURE__ */ D("li", { children: e }, e)) }) })
324
+ }) : null,
325
+ /* @__PURE__ */ O("ul", {
326
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5",
327
+ children: [/* @__PURE__ */ O("li", {
328
+ "aria-hidden": !0,
329
+ className: "ttw:flex ttw:h-5 ttw:items-center ttw:gap-2.5 ttw:text-sm ttw:leading-5 ttw:font-medium",
330
+ children: [
331
+ /* @__PURE__ */ D("span", {
332
+ className: "ttw:inline-flex ttw:min-w-30 ttw:flex-1 ttw:whitespace-nowrap",
333
+ children: Q.productLabel
334
+ }),
335
+ /* @__PURE__ */ D("span", {
336
+ className: "ttw:w-24 ttw:min-w-24",
337
+ children: Q.quantityLabel
338
+ }),
339
+ /* @__PURE__ */ D("span", {
340
+ className: "ttw:w-20.5 ttw:min-w-20.5",
341
+ children: Q.unitLabel
342
+ }),
343
+ /* @__PURE__ */ D("span", {
344
+ className: "ttw:w-full ttw:max-w-41 ttw:min-w-29",
345
+ children: Q.priceLabel
346
+ }),
347
+ /* @__PURE__ */ D("span", {
348
+ className: "ttw:w-12 ttw:min-w-12",
349
+ children: Q.taxableLabel
350
+ }),
351
+ v.lineItems.length > 1 && /* @__PURE__ */ D("span", { className: "ttw:w-10 ttw:min-w-10" })
352
+ ]
353
+ }), N ? /* @__PURE__ */ D("li", {
354
+ className: "ttw:flex ttw:h-9 ttw:items-center ttw:justify-center",
355
+ children: /* @__PURE__ */ D(S, { className: "ttw:size-5" })
356
+ }) : v.lineItems.map((e) => /* @__PURE__ */ D(ie, {
357
+ formId: $,
358
+ lineItem: e,
359
+ errors: y?.lineItems?.[e.id],
360
+ controls: j?.[e.id],
361
+ focusOnMount: e.id === M,
362
+ canRemove: v.lineItems.length > 1,
363
+ unitOptions: b,
364
+ currencySymbol: k,
365
+ labels: Q,
366
+ renderProductSelector: B,
367
+ onChange: (t) => H(e.id, t),
368
+ onCommit: (t) => U(e.id, t),
369
+ onQuantityStep: (t) => W(e.id, t),
370
+ onManageUnits: oe,
371
+ onRemove: () => ce(e.id)
372
+ }, e.id))]
373
+ }),
374
+ /* @__PURE__ */ O(n, {
375
+ type: "button",
376
+ variant: "ghost",
377
+ className: "ttw:w-fit ttw:text-primary ttw:hover:text-primary",
378
+ onClick: se,
379
+ children: [/* @__PURE__ */ D(A, { className: "ttw:size-5 ttw:text-primary" }), Q.addLineItemButton]
380
+ }),
381
+ /* @__PURE__ */ D(ae, {
382
+ inputId: `${$}-discount`,
383
+ discountType: v.discountType,
384
+ value: v.discount,
385
+ error: y?.discount,
386
+ currencySymbol: k,
387
+ disabled: L,
388
+ labels: Q,
389
+ onChange: (e) => V({ discount: e }),
390
+ onTypeChange: (e) => V({ discountType: e }),
391
+ onFocus: K,
392
+ onBlur: q
393
+ }),
394
+ /* @__PURE__ */ O(u, {
395
+ className: "ttw:flex-col",
396
+ children: [/* @__PURE__ */ O(d, {
397
+ className: "ttw:flex-row ttw:justify-end",
398
+ children: [/* @__PURE__ */ D(p, {
399
+ htmlFor: `${$}-tax-rate`,
400
+ className: w(y?.taxRate && "ttw:text-destructive"),
401
+ children: Q.taxRateLabel
402
+ }), /* @__PURE__ */ O("div", {
403
+ className: w(P, "ttw:w-40"),
404
+ children: [/* @__PURE__ */ D("input", {
405
+ id: `${$}-tax-rate`,
406
+ className: w(F, "ttw:pl-3"),
407
+ placeholder: Q.taxRatePlaceholder,
408
+ type: "text",
409
+ inputMode: "decimal",
410
+ "aria-invalid": !!y?.taxRate || void 0,
411
+ "aria-describedby": y?.taxRate ? `${$}-tax-rate-error` : void 0,
412
+ value: v.taxRate,
413
+ onChange: (e) => V({ taxRate: e.target.value }),
414
+ onBlur: G
415
+ }), /* @__PURE__ */ D("span", {
416
+ className: w(I, "ttw:pr-3"),
417
+ children: Q.taxRateSuffix
418
+ })]
419
+ })]
420
+ }), y?.taxRate && /* @__PURE__ */ D(f, {
421
+ id: `${$}-tax-rate-error`,
422
+ className: "ttw:text-right",
423
+ children: y.taxRate
424
+ })]
425
+ }),
426
+ /* @__PURE__ */ D(x, {}),
427
+ /* @__PURE__ */ D(ee, {
428
+ totals: J,
429
+ labels: Q
430
+ })
431
+ ]
432
+ }),
433
+ de,
434
+ /* @__PURE__ */ D(E, {
435
+ idPrefix: $,
436
+ openingNote: v.openingNote,
437
+ closingNote: v.closingNote,
438
+ openingNoteError: y?.openingNote,
439
+ closingNoteError: y?.closingNote,
440
+ disabled: L,
441
+ onOpeningNoteChange: (e) => V({ openingNote: e }),
442
+ onClosingNoteChange: (e) => V({ closingNote: e }),
443
+ labels: Q
444
+ }),
445
+ fe
446
+ ]
447
+ })]
448
+ }), /* @__PURE__ */ O(s, {
449
+ 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",
450
+ children: [
451
+ /* @__PURE__ */ D(n, {
452
+ type: "button",
453
+ variant: "outline",
454
+ className: "ttw:border-border",
455
+ disabled: he,
456
+ onClick: g,
457
+ children: Q.cancelButton
458
+ }),
459
+ X && /* @__PURE__ */ D(n, {
460
+ type: "submit",
461
+ form: $,
462
+ variant: "secondary",
463
+ loading: _e,
464
+ disabled: ge,
465
+ onClick: Se,
466
+ children: X
467
+ }),
468
+ /* @__PURE__ */ D(n, {
469
+ type: "submit",
470
+ form: $,
471
+ loading: be,
472
+ disabled: ye,
473
+ onClick: Ce,
474
+ children: ve
475
+ })
476
+ ]
477
+ })]
478
+ }), /* @__PURE__ */ D("div", {
479
+ className: "ttw:h-full ttw:min-h-0 ttw:w-1/2 ttw:overflow-auto ttw:bg-linear-to-b ttw:from-[#F6F6F6] ttw:to-[#E4E4FF]",
480
+ children: pe
481
+ })]
482
+ })]
483
+ })
484
+ });
6
485
  }
7
486
  //#endregion
8
- export { r as PreviewLines };
487
+ export { z as ReceivableFormDialog, z as default };