@tesouro/embedded-components-react 0.5.211 → 0.5.212

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 (33) hide show
  1. package/dist/index.d.ts +16 -0
  2. package/dist/index.js +1 -1
  3. package/dist/lib/ReceivablesWidget.d.ts +16 -0
  4. package/dist/lib/ReceivablesWidget.js +1 -1
  5. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js +1 -1
  6. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index10.js +113 -109
  7. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js +416 -132
  8. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +113 -211
  9. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +154 -37
  10. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +193 -135
  11. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +32 -37
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +150 -58
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +35 -89
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +58 -116
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +96 -47
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js +103 -347
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +364 -64
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js +66 -106
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +105 -275
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index24.js +288 -0
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index6.js +76 -61
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +48 -422
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +5 -5
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +38 -62
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +61 -391
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +457 -89
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +91 -234
  28. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +234 -78
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +80 -331
  30. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +344 -0
  31. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index3.js +10 -0
  32. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  33. package/package.json +1 -1
@@ -1,106 +1,474 @@
1
- import { Button as e, Dialog as t, DialogContent as n, DialogDescription as r, DialogFooter as i, DialogHeader as a, DialogTitle as o, Input as s, Label as c, RadioGroup as l, RadioGroupItem as u, Textarea as d } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { RECEIVABLE_PAYMENT_DIALOG_LABELS_EN as f } from "./index3.js";
3
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
1
+ import { Alert as e, AlertDescription as t, Button as n, Checkbox as r, Field as i, FieldContent as a, FieldError as o, FieldLabel as s, Input as c, InputGroup as l, InputGroupAddon as u, InputGroupInput as d, Label as f, RadioGroup as p, RadioGroupItem as m, Select as h, SelectContent as g, SelectItem as _, SelectTrigger as v, SelectValue as y, Separator as b, Sheet as x, SheetContent as S, SheetDescription as C, SheetFooter as w, SheetHeader as T, SheetTitle as ee, Spinner as E, Typography as D, cn as O } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { RECEIVABLE_FORM_SHEET_LABELS_EN as te } from "./index3.js";
3
+ import { ReceivableFormTotals as k } from "./index22.js";
4
+ import { ReceivableNotesSection as A } from "./index23.js";
5
+ import { useId as ne } from "react";
6
+ import { jsx as j, jsxs as M } from "react/jsx-runtime";
7
+ import { MinusIcon as N, PlusIcon as P, Trash2Icon as F } from "lucide-react";
4
8
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js
5
- function h({ message: e }) {
6
- return e ? /* @__PURE__ */ p("p", {
9
+ var I = "__none__", L = "__manage__";
10
+ function R({ message: e }) {
11
+ return e ? /* @__PURE__ */ j("p", {
7
12
  className: "ttw:text-sm ttw:text-destructive",
8
13
  children: e
9
14
  }) : null;
10
15
  }
11
- function g({ open: g, onOpenChange: _, values: v, errors: y, inProgress: b, onChange: x, onSubmit: S, onCancel: C, labels: w }) {
12
- let T = {
13
- ...f,
14
- ...w
15
- };
16
- return /* @__PURE__ */ p(t, {
17
- open: g,
18
- onOpenChange: _,
19
- children: /* @__PURE__ */ m(n, { children: [
20
- /* @__PURE__ */ m(a, { children: [/* @__PURE__ */ p(o, { children: T.title }), /* @__PURE__ */ p(r, { children: T.description })] }),
21
- /* @__PURE__ */ m("div", {
22
- className: "ttw:flex ttw:flex-col ttw:gap-4",
16
+ function re({ formId: e, lineItem: t, errors: i, controls: a, focusOnMount: o, canRemove: s, unitOptions: c, currencySymbol: f, labels: p, renderProductSelector: m, onChange: b, onCommit: x, onQuantityStep: S, onManageUnits: C, onRemove: w }) {
17
+ let T = `${e}-line-${t.id}`;
18
+ return /* @__PURE__ */ M("li", {
19
+ className: "ttw:flex ttw:h-9 ttw:items-center ttw:gap-2.5",
20
+ children: [
21
+ /* @__PURE__ */ j("div", {
22
+ className: "ttw:min-w-30 ttw:flex-1",
23
+ children: m(t, {
24
+ inputId: `${T}-name`,
25
+ invalid: !!i?.name,
26
+ focusOnMount: o
27
+ })
28
+ }),
29
+ /* @__PURE__ */ M("div", {
30
+ className: O("ttw:flex ttw:h-9 ttw:w-26 ttw:min-w-26 ttw:items-center ttw:rounded-md ttw:border ttw:border-input ttw:shadow-xs", i?.quantity && "ttw:border-destructive"),
23
31
  children: [
24
- y?.form && /* @__PURE__ */ p("p", {
25
- className: "ttw:rounded-md ttw:bg-destructive/10 ttw:px-3 ttw:py-2 ttw:text-sm ttw:text-destructive",
26
- children: y.form
32
+ /* @__PURE__ */ j("button", {
33
+ type: "button",
34
+ "aria-label": p.decreaseQuantityButton,
35
+ disabled: a ? !a.canDecreaseQuantity : !1,
36
+ className: "ttw:flex ttw:size-6 ttw:shrink-0 ttw:items-center ttw:justify-center ttw:rounded-sm ttw:text-muted-foreground ttw:hover:bg-accent ttw:disabled:pointer-events-none ttw:disabled:opacity-50",
37
+ onClick: () => S(-1),
38
+ children: /* @__PURE__ */ j(N, { className: "ttw:size-3.5" })
27
39
  }),
28
- /* @__PURE__ */ m("div", {
29
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
30
- children: [/* @__PURE__ */ p(c, { children: T.modeLabel }), /* @__PURE__ */ m(l, {
31
- className: "ttw:flex ttw:flex-row ttw:gap-6",
32
- value: v.mode,
33
- onValueChange: (e) => x({ mode: e }),
34
- children: [/* @__PURE__ */ m("div", {
35
- className: "ttw:flex ttw:items-center ttw:gap-2",
36
- children: [/* @__PURE__ */ p(u, {
37
- value: "full",
38
- id: "receivable-payment-full"
39
- }), /* @__PURE__ */ p(c, {
40
- htmlFor: "receivable-payment-full",
41
- children: T.fullPayment
42
- })]
43
- }), /* @__PURE__ */ m("div", {
44
- className: "ttw:flex ttw:items-center ttw:gap-2",
45
- children: [/* @__PURE__ */ p(u, {
46
- value: "partial",
47
- id: "receivable-payment-partial"
48
- }), /* @__PURE__ */ p(c, {
49
- htmlFor: "receivable-payment-partial",
50
- children: T.partialPayment
51
- })]
52
- })]
53
- })]
40
+ /* @__PURE__ */ j("input", {
41
+ id: `${T}-quantity`,
42
+ "aria-label": p.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) => b({ quantity: e.target.value }),
49
+ onBlur: () => x("quantity")
54
50
  }),
55
- v.mode === "partial" && /* @__PURE__ */ m("div", {
56
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
57
- children: [
58
- /* @__PURE__ */ p(c, { children: T.amountPaidLabel }),
59
- /* @__PURE__ */ p(s, {
60
- inputMode: "decimal",
61
- value: v.amountPaid,
62
- onChange: (e) => x({ amountPaid: e.target.value })
63
- }),
64
- /* @__PURE__ */ p(h, { message: y?.amountPaid })
65
- ]
51
+ /* @__PURE__ */ j("button", {
52
+ type: "button",
53
+ "aria-label": p.increaseQuantityButton,
54
+ disabled: a ? !a.canIncreaseQuantity : !1,
55
+ className: "ttw:flex ttw:size-6 ttw:shrink-0 ttw:items-center ttw:justify-center ttw:rounded-sm ttw:text-muted-foreground ttw:hover:bg-accent ttw:disabled:pointer-events-none ttw:disabled:opacity-50",
56
+ onClick: () => S(1),
57
+ children: /* @__PURE__ */ j(P, { className: "ttw:size-3.5" })
58
+ })
59
+ ]
60
+ }),
61
+ /* @__PURE__ */ M(h, {
62
+ value: t.unit || I,
63
+ onValueChange: (e) => {
64
+ if (e === L) {
65
+ C?.();
66
+ return;
67
+ }
68
+ b({ unit: e === I ? "" : e });
69
+ },
70
+ children: [/* @__PURE__ */ j(v, {
71
+ id: `${T}-unit`,
72
+ "aria-label": p.unitLabel,
73
+ "aria-invalid": !!i?.measureUnit || void 0,
74
+ className: "ttw:w-22",
75
+ children: /* @__PURE__ */ j(y, {
76
+ className: "ttw:truncate",
77
+ placeholder: p.unitPlaceholder
78
+ })
79
+ }), /* @__PURE__ */ M(g, { children: [
80
+ C && /* @__PURE__ */ M(_, {
81
+ value: L,
82
+ className: "ttw:font-semibold ttw:text-primary ttw:hover:text-primary ttw:focus:text-primary",
83
+ children: [/* @__PURE__ */ j(P, { className: "ttw:text-primary" }), p.manageUnitsOption]
66
84
  }),
67
- v.mode === "full" && /* @__PURE__ */ m("div", {
68
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
69
- children: [
70
- /* @__PURE__ */ p(c, { children: T.paidAtLabel }),
71
- /* @__PURE__ */ p(s, {
72
- type: "date",
73
- value: v.paidAt,
74
- onChange: (e) => x({ paidAt: e.target.value })
75
- }),
76
- /* @__PURE__ */ p(h, { message: y?.paidAt })
77
- ]
85
+ /* @__PURE__ */ j(_, {
86
+ value: I,
87
+ children: p.unitNone
78
88
  }),
79
- /* @__PURE__ */ m("div", {
80
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
89
+ c.map((e) => /* @__PURE__ */ j(_, {
90
+ value: e.value,
91
+ children: e.label
92
+ }, e.value))
93
+ ] })]
94
+ }),
95
+ /* @__PURE__ */ M(l, {
96
+ className: "ttw:w-full ttw:max-w-41 ttw:min-w-29",
97
+ children: [/* @__PURE__ */ j(u, {
98
+ align: "inline-start",
99
+ children: f
100
+ }), /* @__PURE__ */ j(d, {
101
+ id: `${T}-price`,
102
+ "aria-label": p.priceLabel,
103
+ "aria-invalid": !!i?.price || void 0,
104
+ "data-has-start-addon": !0,
105
+ type: "text",
106
+ inputMode: "decimal",
107
+ className: "ttw:text-right",
108
+ value: t.price,
109
+ onChange: (e) => b({ price: e.target.value }),
110
+ onBlur: () => x("price")
111
+ })]
112
+ }),
113
+ /* @__PURE__ */ j("div", {
114
+ className: "ttw:flex ttw:w-12 ttw:min-w-12 ttw:items-center ttw:justify-center",
115
+ children: /* @__PURE__ */ j(r, {
116
+ id: `${T}-taxable`,
117
+ "aria-label": p.taxableLabel,
118
+ checked: t.taxable,
119
+ onCheckedChange: (e) => b({ taxable: e === !0 })
120
+ })
121
+ }),
122
+ s && /* @__PURE__ */ j(n, {
123
+ type: "button",
124
+ variant: "ghost",
125
+ size: "sm",
126
+ "aria-label": p.removeLineItemButton,
127
+ 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",
128
+ onClick: w,
129
+ children: /* @__PURE__ */ j(F, {})
130
+ })
131
+ ]
132
+ });
133
+ }
134
+ function ie({ inputId: e, discountType: t, value: n, error: r, currencySymbol: c, disabled: f, labels: p, onChange: m, onTypeChange: h, onFocus: g, onBlur: _ }) {
135
+ let v = `${e}-error`, y = [{
136
+ type: "amount",
137
+ label: c,
138
+ ariaLabel: p.discountAmountOptionAriaLabel
139
+ }, {
140
+ type: "percentage",
141
+ label: p.discountPercentageOption,
142
+ ariaLabel: p.discountPercentageOptionAriaLabel
143
+ }];
144
+ return /* @__PURE__ */ M(i, {
145
+ className: "ttw:flex-col",
146
+ children: [/* @__PURE__ */ M(a, {
147
+ className: "ttw:flex-row ttw:items-center ttw:justify-end",
148
+ children: [/* @__PURE__ */ j(s, {
149
+ htmlFor: e,
150
+ className: O(r && "ttw:text-destructive"),
151
+ children: p.discountLabel
152
+ }), /* @__PURE__ */ M(l, {
153
+ className: "ttw:w-40 ttw:overflow-hidden",
154
+ children: [/* @__PURE__ */ j(u, {
155
+ align: "inline-start",
156
+ className: "ttw:gap-0 ttw:self-stretch ttw:p-0 ttw:has-[>button]:ml-0",
157
+ children: y.map((e) => /* @__PURE__ */ j("button", {
158
+ type: "button",
159
+ "aria-label": e.ariaLabel,
160
+ "aria-pressed": t === e.type,
161
+ disabled: f,
162
+ className: O("ttw:pointer-events-auto 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"),
163
+ onClick: () => h(e.type),
164
+ children: e.label
165
+ }, e.type))
166
+ }), /* @__PURE__ */ j(d, {
167
+ id: e,
168
+ type: "text",
169
+ inputMode: "decimal",
170
+ className: "ttw:text-right",
171
+ "aria-invalid": !!r || void 0,
172
+ "aria-describedby": r ? v : void 0,
173
+ disabled: f,
174
+ value: n,
175
+ onChange: (e) => m(e.target.value),
176
+ onFocus: g,
177
+ onBlur: _
178
+ })]
179
+ })]
180
+ }), r && /* @__PURE__ */ j(o, {
181
+ id: v,
182
+ className: "ttw:text-right",
183
+ children: r
184
+ })]
185
+ });
186
+ }
187
+ function z({ open: r, onOpenChange: o, mode: N = "create", values: F, errors: I, currencyOptions: L, unitOptions: z, currencySymbol: B, lineItemControls: V, autoFocusLineItemId: H, lineItemsLoading: U, inProgress: W, customerSelector: G, renderProductSelector: K, onChange: q, onLineItemChange: J, onLineItemCommit: ae, onLineItemQuantityStep: Y, onTaxRateCommit: oe, onDiscountFocus: se, onDiscountCommit: ce, totals: le, onManageUnits: ue, onAddLineItem: de, onRemoveLineItem: fe, showDueDateField: X, billingSection: pe, remindersSection: me, bankAccountSection: he, attachmentsSection: ge, cancelDisabled: _e, saveDisabled: ve, onSubmit: ye, onCancel: be, labels: xe }) {
188
+ let Z = {
189
+ ...te,
190
+ ...xe
191
+ }, Q = ne(), $ = N === "edit", Se = O("ttw:grid ttw:gap-4", $ && X ? "ttw:grid-cols-3" : "ttw:grid-cols-2");
192
+ return /* @__PURE__ */ j(x, {
193
+ open: r,
194
+ onOpenChange: o,
195
+ children: /* @__PURE__ */ M(S, {
196
+ className: "ttw:w-180 ttw:overflow-y-auto ttw:sm:max-w-180",
197
+ children: [
198
+ /* @__PURE__ */ M(T, { children: [/* @__PURE__ */ j(ee, { children: N === "edit" ? Z.editTitle : Z.createTitle }), /* @__PURE__ */ j(C, {
199
+ className: "ttw:sr-only",
200
+ children: Z.hiddenDescription
201
+ })] }),
202
+ /* @__PURE__ */ j("form", {
203
+ id: Q,
204
+ onSubmit: (e) => {
205
+ e.preventDefault(), e.stopPropagation(), ye();
206
+ },
207
+ children: /* @__PURE__ */ M("div", {
208
+ className: "ttw:flex ttw:flex-col ttw:gap-5 ttw:px-6 ttw:pb-6",
81
209
  children: [
82
- /* @__PURE__ */ p(c, { children: T.commentLabel }),
83
- /* @__PURE__ */ p(d, {
84
- rows: 3,
85
- value: v.comment,
86
- onChange: (e) => x({ comment: e.target.value })
210
+ I?.form && /* @__PURE__ */ j("p", {
211
+ role: "alert",
212
+ className: "ttw:rounded-md ttw:bg-destructive/10 ttw:px-3 ttw:py-2 ttw:text-sm ttw:text-destructive",
213
+ children: I.form
214
+ }),
215
+ /* @__PURE__ */ M("div", {
216
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
217
+ children: [
218
+ /* @__PURE__ */ j(f, { children: Z.documentTypeLabel }),
219
+ /* @__PURE__ */ M(p, {
220
+ className: "ttw:flex ttw:flex-row ttw:gap-6",
221
+ disabled: N === "edit",
222
+ value: F.type,
223
+ onValueChange: (e) => q({ type: e }),
224
+ children: [/* @__PURE__ */ M("div", {
225
+ className: "ttw:flex ttw:items-center ttw:gap-2",
226
+ children: [/* @__PURE__ */ j(m, {
227
+ value: "invoice",
228
+ id: `${Q}-invoice`
229
+ }), /* @__PURE__ */ j(f, {
230
+ htmlFor: `${Q}-invoice`,
231
+ children: Z.typeInvoice
232
+ })]
233
+ }), /* @__PURE__ */ M("div", {
234
+ className: "ttw:flex ttw:items-center ttw:gap-2",
235
+ children: [/* @__PURE__ */ j(m, {
236
+ value: "quote",
237
+ id: `${Q}-quote`
238
+ }), /* @__PURE__ */ j(f, {
239
+ htmlFor: `${Q}-quote`,
240
+ children: Z.typeQuote
241
+ })]
242
+ })]
243
+ }),
244
+ /* @__PURE__ */ j(R, { message: I?.type })
245
+ ]
246
+ }),
247
+ /* @__PURE__ */ M("div", {
248
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
249
+ children: [
250
+ /* @__PURE__ */ j(f, { children: Z.customerLabel }),
251
+ G,
252
+ /* @__PURE__ */ j("p", {
253
+ className: "ttw:text-xs ttw:text-muted-foreground",
254
+ children: Z.customerHint
255
+ }),
256
+ /* @__PURE__ */ j(R, { message: I?.customerId })
257
+ ]
87
258
  }),
88
- /* @__PURE__ */ p(h, { message: y?.comment })
259
+ /* @__PURE__ */ M("div", {
260
+ className: Se,
261
+ children: [
262
+ /* @__PURE__ */ M("div", {
263
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
264
+ children: [
265
+ /* @__PURE__ */ j(f, {
266
+ htmlFor: `${Q}-currency`,
267
+ children: Z.currencyLabel
268
+ }),
269
+ /* @__PURE__ */ M(h, {
270
+ value: F.currency,
271
+ onValueChange: (e) => q({ currency: e }),
272
+ children: [/* @__PURE__ */ j(v, {
273
+ id: `${Q}-currency`,
274
+ children: /* @__PURE__ */ j(y, {})
275
+ }), /* @__PURE__ */ j(g, { children: L.map((e) => /* @__PURE__ */ j(_, {
276
+ value: e.value,
277
+ children: e.label
278
+ }, e.value)) })]
279
+ }),
280
+ /* @__PURE__ */ j(R, { message: I?.currency })
281
+ ]
282
+ }),
283
+ $ && /* @__PURE__ */ M("div", {
284
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
285
+ children: [
286
+ /* @__PURE__ */ j(f, {
287
+ htmlFor: `${Q}-issue-date`,
288
+ children: Z.issueDateLabel
289
+ }),
290
+ /* @__PURE__ */ j(c, {
291
+ id: `${Q}-issue-date`,
292
+ type: "date",
293
+ value: F.issueDate,
294
+ onChange: (e) => q({ issueDate: e.target.value })
295
+ }),
296
+ /* @__PURE__ */ j(R, { message: I?.issueDate })
297
+ ]
298
+ }),
299
+ X && /* @__PURE__ */ M("div", {
300
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
301
+ children: [
302
+ /* @__PURE__ */ j(f, {
303
+ htmlFor: `${Q}-due-date`,
304
+ children: Z.dueDateLabel
305
+ }),
306
+ /* @__PURE__ */ j(c, {
307
+ id: `${Q}-due-date`,
308
+ type: "date",
309
+ value: F.dueDate,
310
+ onChange: (e) => q({ dueDate: e.target.value })
311
+ }),
312
+ /* @__PURE__ */ j(R, { message: I?.dueDate })
313
+ ]
314
+ })
315
+ ]
316
+ }),
317
+ pe,
318
+ me,
319
+ /* @__PURE__ */ M("div", {
320
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:rounded-xl ttw:border ttw:border-border ttw:p-6",
321
+ children: [
322
+ /* @__PURE__ */ M("div", {
323
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:pb-4",
324
+ children: [/* @__PURE__ */ j(D, {
325
+ variant: "h4",
326
+ children: Z.lineItemsHeading
327
+ }), /* @__PURE__ */ j(D, {
328
+ variant: "body2",
329
+ color: "muted",
330
+ className: "ttw:font-medium",
331
+ children: Z.lineItemsDescription
332
+ })]
333
+ }),
334
+ I?.lineItemsSummary?.length ? /* @__PURE__ */ j(e, {
335
+ variant: "destructive",
336
+ className: "ttw:mb-2",
337
+ children: /* @__PURE__ */ j(t, { children: /* @__PURE__ */ j("ul", { children: I.lineItemsSummary.map((e) => /* @__PURE__ */ j("li", { children: e }, e)) }) })
338
+ }) : null,
339
+ /* @__PURE__ */ M("ul", {
340
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5",
341
+ children: [/* @__PURE__ */ M("li", {
342
+ "aria-hidden": !0,
343
+ className: "ttw:flex ttw:h-5 ttw:items-center ttw:gap-2.5 ttw:text-sm ttw:leading-5 ttw:font-medium",
344
+ children: [
345
+ /* @__PURE__ */ j("span", {
346
+ className: "ttw:inline-flex ttw:min-w-30 ttw:flex-1 ttw:whitespace-nowrap",
347
+ children: Z.productLabel
348
+ }),
349
+ /* @__PURE__ */ j("span", {
350
+ className: "ttw:w-24 ttw:min-w-24",
351
+ children: Z.quantityLabel
352
+ }),
353
+ /* @__PURE__ */ j("span", {
354
+ className: "ttw:w-20.5 ttw:min-w-20.5",
355
+ children: Z.unitLabel
356
+ }),
357
+ /* @__PURE__ */ j("span", {
358
+ className: "ttw:w-full ttw:max-w-41 ttw:min-w-29",
359
+ children: Z.priceLabel
360
+ }),
361
+ /* @__PURE__ */ j("span", {
362
+ className: "ttw:w-12 ttw:min-w-12",
363
+ children: Z.taxableLabel
364
+ }),
365
+ F.lineItems.length > 1 && /* @__PURE__ */ j("span", { className: "ttw:w-10 ttw:min-w-10" })
366
+ ]
367
+ }), U ? /* @__PURE__ */ j("li", {
368
+ className: "ttw:flex ttw:h-9 ttw:items-center ttw:justify-center",
369
+ children: /* @__PURE__ */ j(E, { className: "ttw:size-5" })
370
+ }) : F.lineItems.map((e) => /* @__PURE__ */ j(re, {
371
+ formId: Q,
372
+ lineItem: e,
373
+ errors: I?.lineItems?.[e.id],
374
+ controls: V?.[e.id],
375
+ focusOnMount: e.id === H,
376
+ canRemove: F.lineItems.length > 1,
377
+ unitOptions: z,
378
+ currencySymbol: B,
379
+ labels: Z,
380
+ renderProductSelector: K,
381
+ onChange: (t) => J(e.id, t),
382
+ onCommit: (t) => ae(e.id, t),
383
+ onQuantityStep: (t) => Y(e.id, t),
384
+ onManageUnits: ue,
385
+ onRemove: () => fe(e.id)
386
+ }, e.id))]
387
+ }),
388
+ /* @__PURE__ */ M(n, {
389
+ type: "button",
390
+ variant: "ghost",
391
+ className: "ttw:w-fit ttw:text-primary ttw:hover:text-primary",
392
+ onClick: de,
393
+ children: [/* @__PURE__ */ j(P, { className: "ttw:size-5 ttw:text-primary" }), Z.addLineItemButton]
394
+ }),
395
+ /* @__PURE__ */ j(ie, {
396
+ inputId: `${Q}-discount`,
397
+ discountType: F.discountType,
398
+ value: F.discount,
399
+ error: I?.discount,
400
+ currencySymbol: B,
401
+ disabled: W,
402
+ labels: Z,
403
+ onChange: (e) => q({ discount: e }),
404
+ onTypeChange: (e) => q({ discountType: e }),
405
+ onFocus: se,
406
+ onBlur: ce
407
+ }),
408
+ /* @__PURE__ */ j(i, { children: /* @__PURE__ */ M(a, {
409
+ className: "ttw:flex-row ttw:justify-end",
410
+ children: [/* @__PURE__ */ j(s, {
411
+ htmlFor: `${Q}-tax-rate`,
412
+ children: Z.taxRateLabel
413
+ }), /* @__PURE__ */ M(l, {
414
+ className: "ttw:w-40 ttw:has-[>[data-align=inline-end]]:[&>input]:pr-0",
415
+ children: [/* @__PURE__ */ j(d, {
416
+ id: `${Q}-tax-rate`,
417
+ className: "ttw:text-right",
418
+ placeholder: Z.taxRatePlaceholder,
419
+ type: "text",
420
+ inputMode: "decimal",
421
+ value: F.taxRate,
422
+ onChange: (e) => q({ taxRate: e.target.value }),
423
+ onBlur: oe
424
+ }), /* @__PURE__ */ j(u, {
425
+ align: "inline-end",
426
+ children: Z.taxRateSuffix
427
+ })]
428
+ })]
429
+ }) }),
430
+ /* @__PURE__ */ j(b, {}),
431
+ /* @__PURE__ */ j(k, {
432
+ totals: le,
433
+ labels: Z
434
+ })
435
+ ]
436
+ }),
437
+ he,
438
+ /* @__PURE__ */ j(A, {
439
+ idPrefix: Q,
440
+ openingNote: F.openingNote,
441
+ closingNote: F.closingNote,
442
+ openingNoteError: I?.openingNote,
443
+ closingNoteError: I?.closingNote,
444
+ disabled: W,
445
+ onOpeningNoteChange: (e) => q({ openingNote: e }),
446
+ onClosingNoteChange: (e) => q({ closingNote: e }),
447
+ labels: Z
448
+ }),
449
+ ge
89
450
  ]
90
451
  })
91
- ]
92
- }),
93
- /* @__PURE__ */ m(i, { children: [/* @__PURE__ */ p(e, {
94
- variant: "ghost",
95
- onClick: C,
96
- children: T.cancelButton
97
- }), /* @__PURE__ */ p(e, {
98
- loading: b,
99
- onClick: S,
100
- children: T.submitButton
101
- })] })
102
- ] })
452
+ }),
453
+ /* @__PURE__ */ j(w, { children: /* @__PURE__ */ M("div", {
454
+ className: "ttw:flex ttw:justify-end ttw:gap-2",
455
+ children: [/* @__PURE__ */ j(n, {
456
+ type: "button",
457
+ variant: "ghost",
458
+ disabled: _e,
459
+ onClick: be,
460
+ children: Z.cancelButton
461
+ }), /* @__PURE__ */ j(n, {
462
+ type: "submit",
463
+ form: Q,
464
+ loading: W,
465
+ disabled: ve,
466
+ children: N === "edit" ? Z.updateButton : Z.createButton
467
+ })]
468
+ }) })
469
+ ]
470
+ })
103
471
  });
104
472
  }
105
473
  //#endregion
106
- export { g as ReceivablePaymentDialog, g as default };
474
+ export { z as ReceivableFormSheet, z as default };