@tesouro/embedded-components-react 0.5.268 → 0.5.270

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