@tesouro/embedded-components-react 0.5.196 → 0.5.198

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.
@@ -1,106 +1,386 @@
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 "./index2.js";
3
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
1
+ import { Alert as e, AlertDescription as t, Button as n, Input as r, InputGroup as i, InputGroupAddon as a, InputGroupInput as o, Label as s, RadioGroup as c, RadioGroupItem as l, Select as u, SelectContent as d, SelectItem as f, SelectTrigger as p, SelectValue as m, Sheet as h, SheetContent as g, SheetDescription as _, SheetFooter as v, SheetHeader as y, SheetTitle as b, Spinner as x, Typography as S, cn as C } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { RECEIVABLE_FORM_SHEET_LABELS_EN as w } from "./index2.js";
3
+ import { ReceivableNotesSection as T } from "./index13.js";
4
+ import { useId as ee } from "react";
5
+ import { jsx as E, jsxs as D } from "react/jsx-runtime";
6
+ import { MinusIcon as O, PlusIcon as k, Trash2Icon as A } from "lucide-react";
4
7
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js
5
- function h({ message: e }) {
6
- return e ? /* @__PURE__ */ p("p", {
8
+ var j = "__none__", M = "__manage__";
9
+ function N({ message: e }) {
10
+ return e ? /* @__PURE__ */ E("p", {
7
11
  className: "ttw:text-sm ttw:text-destructive",
8
12
  children: e
9
13
  }) : null;
10
14
  }
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",
15
+ function P({ formId: e, lineItem: t, errors: r, controls: s, focusOnMount: c, canRemove: l, unitOptions: h, currencySymbol: g, labels: _, renderProductSelector: v, onChange: y, onCommit: b, onQuantityStep: x, onManageUnits: S, onRemove: w }) {
16
+ let T = `${e}-line-${t.id}`;
17
+ return /* @__PURE__ */ D("li", {
18
+ className: "ttw:flex ttw:h-9 ttw:items-center ttw:gap-2.5",
19
+ children: [
20
+ /* @__PURE__ */ E("div", {
21
+ className: "ttw:min-w-30 ttw:flex-1",
22
+ children: v(t, {
23
+ inputId: `${T}-name`,
24
+ invalid: !!r?.name,
25
+ focusOnMount: c
26
+ })
27
+ }),
28
+ /* @__PURE__ */ D("div", {
29
+ className: C("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", r?.quantity && "ttw:border-destructive"),
23
30
  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
31
+ /* @__PURE__ */ E("button", {
32
+ type: "button",
33
+ "aria-label": _.decreaseQuantityButton,
34
+ disabled: s ? !s.canDecreaseQuantity : !1,
35
+ 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",
36
+ onClick: () => x(-1),
37
+ children: /* @__PURE__ */ E(O, { className: "ttw:size-3.5" })
27
38
  }),
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
- })]
39
+ /* @__PURE__ */ E("input", {
40
+ id: `${T}-quantity`,
41
+ "aria-label": _.quantityLabel,
42
+ "aria-invalid": !!r?.quantity || void 0,
43
+ type: "text",
44
+ inputMode: "decimal",
45
+ 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",
46
+ value: t.quantity,
47
+ onChange: (e) => y({ quantity: e.target.value }),
48
+ onBlur: () => b("quantity")
54
49
  }),
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
- ]
50
+ /* @__PURE__ */ E("button", {
51
+ type: "button",
52
+ "aria-label": _.increaseQuantityButton,
53
+ disabled: s ? !s.canIncreaseQuantity : !1,
54
+ 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",
55
+ onClick: () => x(1),
56
+ children: /* @__PURE__ */ E(k, { className: "ttw:size-3.5" })
57
+ })
58
+ ]
59
+ }),
60
+ /* @__PURE__ */ D(u, {
61
+ value: t.unit || j,
62
+ onValueChange: (e) => {
63
+ if (e === M) {
64
+ S?.();
65
+ return;
66
+ }
67
+ y({ unit: e === j ? "" : e });
68
+ },
69
+ children: [/* @__PURE__ */ E(p, {
70
+ id: `${T}-unit`,
71
+ "aria-label": _.unitLabel,
72
+ "aria-invalid": !!r?.measureUnit || void 0,
73
+ className: "ttw:w-22",
74
+ children: /* @__PURE__ */ E(m, {
75
+ className: "ttw:truncate",
76
+ placeholder: _.unitPlaceholder
77
+ })
78
+ }), /* @__PURE__ */ D(d, { children: [
79
+ S && /* @__PURE__ */ D(f, {
80
+ value: M,
81
+ className: "ttw:font-semibold ttw:text-primary ttw:hover:text-primary ttw:focus:text-primary",
82
+ children: [/* @__PURE__ */ E(k, { className: "ttw:text-primary" }), _.manageUnitsOption]
66
83
  }),
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
- ]
84
+ /* @__PURE__ */ E(f, {
85
+ value: j,
86
+ children: _.unitNone
78
87
  }),
79
- /* @__PURE__ */ m("div", {
80
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
88
+ h.map((e) => /* @__PURE__ */ E(f, {
89
+ value: e.value,
90
+ children: e.label
91
+ }, e.value))
92
+ ] })]
93
+ }),
94
+ /* @__PURE__ */ D(i, {
95
+ className: "ttw:w-full ttw:max-w-41 ttw:min-w-29",
96
+ children: [/* @__PURE__ */ E(a, {
97
+ align: "inline-start",
98
+ children: g
99
+ }), /* @__PURE__ */ E(o, {
100
+ id: `${T}-price`,
101
+ "aria-label": _.priceLabel,
102
+ "aria-invalid": !!r?.price || void 0,
103
+ "data-has-start-addon": !0,
104
+ type: "text",
105
+ inputMode: "decimal",
106
+ className: "ttw:text-right",
107
+ value: t.price,
108
+ onChange: (e) => y({ price: e.target.value }),
109
+ onBlur: () => b("price")
110
+ })]
111
+ }),
112
+ l && /* @__PURE__ */ E(n, {
113
+ type: "button",
114
+ variant: "ghost",
115
+ size: "sm",
116
+ "aria-label": _.removeLineItemButton,
117
+ 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",
118
+ onClick: w,
119
+ children: /* @__PURE__ */ E(A, {})
120
+ })
121
+ ]
122
+ });
123
+ }
124
+ function F({ open: i, onOpenChange: a, mode: o = "create", values: C, errors: O, currencyOptions: A, paymentTermsOptions: j, unitOptions: M, currencySymbol: F, lineItemControls: I, autoFocusLineItemId: L, lineItemsLoading: R, inProgress: z, customerSelector: te, renderProductSelector: B, onChange: V, onLineItemChange: H, onLineItemCommit: U, onLineItemQuantityStep: W, onManageUnits: G, onAddLineItem: K, onRemoveLineItem: q, onSubmit: J, onCancel: Y, labels: X }) {
125
+ let Z = {
126
+ ...w,
127
+ ...X
128
+ }, Q = ee(), $ = o === "edit", ne = C.type === "invoice" || o === "edit", re = $ ? "ttw:grid ttw:grid-cols-3 ttw:gap-4" : "ttw:grid ttw:grid-cols-2 ttw:gap-4";
129
+ return /* @__PURE__ */ E(h, {
130
+ open: i,
131
+ onOpenChange: a,
132
+ children: /* @__PURE__ */ D(g, {
133
+ className: "ttw:w-180 ttw:overflow-y-auto ttw:sm:max-w-180",
134
+ children: [
135
+ /* @__PURE__ */ D(y, { children: [/* @__PURE__ */ E(b, { children: o === "edit" ? Z.editTitle : Z.createTitle }), /* @__PURE__ */ E(_, {
136
+ className: "ttw:sr-only",
137
+ children: Z.hiddenDescription
138
+ })] }),
139
+ /* @__PURE__ */ E("form", {
140
+ id: Q,
141
+ onSubmit: (e) => {
142
+ e.preventDefault(), e.stopPropagation(), J();
143
+ },
144
+ children: /* @__PURE__ */ D("div", {
145
+ className: "ttw:flex ttw:flex-col ttw:gap-5 ttw:px-6 ttw:pb-6",
81
146
  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 })
147
+ O?.form && /* @__PURE__ */ E("p", {
148
+ role: "alert",
149
+ className: "ttw:rounded-md ttw:bg-destructive/10 ttw:px-3 ttw:py-2 ttw:text-sm ttw:text-destructive",
150
+ children: O.form
151
+ }),
152
+ /* @__PURE__ */ D("div", {
153
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
154
+ children: [
155
+ /* @__PURE__ */ E(s, { children: Z.documentTypeLabel }),
156
+ /* @__PURE__ */ D(c, {
157
+ className: "ttw:flex ttw:flex-row ttw:gap-6",
158
+ disabled: o === "edit",
159
+ value: C.type,
160
+ onValueChange: (e) => V({ type: e }),
161
+ children: [/* @__PURE__ */ D("div", {
162
+ className: "ttw:flex ttw:items-center ttw:gap-2",
163
+ children: [/* @__PURE__ */ E(l, {
164
+ value: "invoice",
165
+ id: `${Q}-invoice`
166
+ }), /* @__PURE__ */ E(s, {
167
+ htmlFor: `${Q}-invoice`,
168
+ children: Z.typeInvoice
169
+ })]
170
+ }), /* @__PURE__ */ D("div", {
171
+ className: "ttw:flex ttw:items-center ttw:gap-2",
172
+ children: [/* @__PURE__ */ E(l, {
173
+ value: "quote",
174
+ id: `${Q}-quote`
175
+ }), /* @__PURE__ */ E(s, {
176
+ htmlFor: `${Q}-quote`,
177
+ children: Z.typeQuote
178
+ })]
179
+ })]
180
+ }),
181
+ /* @__PURE__ */ E(N, { message: O?.type })
182
+ ]
183
+ }),
184
+ /* @__PURE__ */ D("div", {
185
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
186
+ children: [
187
+ /* @__PURE__ */ E(s, { children: Z.customerLabel }),
188
+ te,
189
+ /* @__PURE__ */ E("p", {
190
+ className: "ttw:text-xs ttw:text-muted-foreground",
191
+ children: Z.customerHint
192
+ }),
193
+ /* @__PURE__ */ E(N, { message: O?.customerId })
194
+ ]
87
195
  }),
88
- /* @__PURE__ */ p(h, { message: y?.comment })
196
+ /* @__PURE__ */ D("div", {
197
+ className: re,
198
+ children: [
199
+ /* @__PURE__ */ D("div", {
200
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
201
+ children: [
202
+ /* @__PURE__ */ E(s, {
203
+ htmlFor: `${Q}-currency`,
204
+ children: Z.currencyLabel
205
+ }),
206
+ /* @__PURE__ */ D(u, {
207
+ value: C.currency,
208
+ onValueChange: (e) => V({ currency: e }),
209
+ children: [/* @__PURE__ */ E(p, {
210
+ id: `${Q}-currency`,
211
+ children: /* @__PURE__ */ E(m, {})
212
+ }), /* @__PURE__ */ E(d, { children: A.map((e) => /* @__PURE__ */ E(f, {
213
+ value: e.value,
214
+ children: e.label
215
+ }, e.value)) })]
216
+ }),
217
+ /* @__PURE__ */ E(N, { message: O?.currency })
218
+ ]
219
+ }),
220
+ $ && /* @__PURE__ */ D("div", {
221
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
222
+ children: [
223
+ /* @__PURE__ */ E(s, {
224
+ htmlFor: `${Q}-issue-date`,
225
+ children: Z.issueDateLabel
226
+ }),
227
+ /* @__PURE__ */ E(r, {
228
+ id: `${Q}-issue-date`,
229
+ type: "date",
230
+ value: C.issueDate,
231
+ onChange: (e) => V({ issueDate: e.target.value })
232
+ }),
233
+ /* @__PURE__ */ E(N, { message: O?.issueDate })
234
+ ]
235
+ }),
236
+ /* @__PURE__ */ D("div", {
237
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
238
+ children: [
239
+ /* @__PURE__ */ E(s, {
240
+ htmlFor: `${Q}-due-date`,
241
+ children: Z.dueDateLabel
242
+ }),
243
+ /* @__PURE__ */ E(r, {
244
+ id: `${Q}-due-date`,
245
+ type: "date",
246
+ value: C.dueDate,
247
+ onChange: (e) => V({ dueDate: e.target.value })
248
+ }),
249
+ /* @__PURE__ */ E(N, { message: O?.dueDate })
250
+ ]
251
+ })
252
+ ]
253
+ }),
254
+ ne && /* @__PURE__ */ D("div", {
255
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
256
+ children: [
257
+ /* @__PURE__ */ E(s, {
258
+ htmlFor: `${Q}-payment-terms`,
259
+ children: Z.paymentTermsLabel
260
+ }),
261
+ /* @__PURE__ */ D(u, {
262
+ value: C.paymentTermsId || void 0,
263
+ onValueChange: (e) => V({ paymentTermsId: e === "__none__" ? "" : e }),
264
+ children: [/* @__PURE__ */ E(p, {
265
+ id: `${Q}-payment-terms`,
266
+ children: /* @__PURE__ */ E(m, { placeholder: Z.paymentTermsPlaceholder })
267
+ }), /* @__PURE__ */ D(d, { children: [/* @__PURE__ */ E(f, {
268
+ value: "__none__",
269
+ children: Z.paymentTermsNone
270
+ }), j.map((e) => /* @__PURE__ */ E(f, {
271
+ value: e.value,
272
+ children: e.label
273
+ }, e.value))] })]
274
+ }),
275
+ /* @__PURE__ */ E(N, { message: O?.paymentTermsId })
276
+ ]
277
+ }),
278
+ /* @__PURE__ */ D("div", {
279
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:rounded-xl ttw:border ttw:border-border ttw:p-6",
280
+ children: [
281
+ /* @__PURE__ */ D("div", {
282
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:pb-4",
283
+ children: [/* @__PURE__ */ E(S, {
284
+ variant: "h4",
285
+ children: Z.lineItemsHeading
286
+ }), /* @__PURE__ */ E(S, {
287
+ variant: "body2",
288
+ color: "muted",
289
+ className: "ttw:font-medium",
290
+ children: Z.lineItemsDescription
291
+ })]
292
+ }),
293
+ O?.lineItemsSummary?.length ? /* @__PURE__ */ E(e, {
294
+ variant: "destructive",
295
+ className: "ttw:mb-2",
296
+ children: /* @__PURE__ */ E(t, { children: /* @__PURE__ */ E("ul", { children: O.lineItemsSummary.map((e) => /* @__PURE__ */ E("li", { children: e }, e)) }) })
297
+ }) : null,
298
+ /* @__PURE__ */ D("ul", {
299
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5",
300
+ children: [/* @__PURE__ */ D("li", {
301
+ "aria-hidden": !0,
302
+ className: "ttw:flex ttw:h-5 ttw:items-center ttw:gap-2.5 ttw:text-sm ttw:leading-5 ttw:font-medium",
303
+ children: [
304
+ /* @__PURE__ */ E("span", {
305
+ className: "ttw:inline-flex ttw:min-w-30 ttw:flex-1 ttw:whitespace-nowrap",
306
+ children: Z.productLabel
307
+ }),
308
+ /* @__PURE__ */ E("span", {
309
+ className: "ttw:w-24 ttw:min-w-24",
310
+ children: Z.quantityLabel
311
+ }),
312
+ /* @__PURE__ */ E("span", {
313
+ className: "ttw:w-20.5 ttw:min-w-20.5",
314
+ children: Z.unitLabel
315
+ }),
316
+ /* @__PURE__ */ E("span", {
317
+ className: "ttw:w-full ttw:max-w-41 ttw:min-w-29",
318
+ children: Z.priceLabel
319
+ }),
320
+ C.lineItems.length > 1 && /* @__PURE__ */ E("span", { className: "ttw:w-10 ttw:min-w-10" })
321
+ ]
322
+ }), R ? /* @__PURE__ */ E("li", {
323
+ className: "ttw:flex ttw:h-9 ttw:items-center ttw:justify-center",
324
+ children: /* @__PURE__ */ E(x, { className: "ttw:size-5" })
325
+ }) : C.lineItems.map((e) => /* @__PURE__ */ E(P, {
326
+ formId: Q,
327
+ lineItem: e,
328
+ errors: O?.lineItems?.[e.id],
329
+ controls: I?.[e.id],
330
+ focusOnMount: e.id === L,
331
+ canRemove: C.lineItems.length > 1,
332
+ unitOptions: M,
333
+ currencySymbol: F,
334
+ labels: Z,
335
+ renderProductSelector: B,
336
+ onChange: (t) => H(e.id, t),
337
+ onCommit: (t) => U(e.id, t),
338
+ onQuantityStep: (t) => W(e.id, t),
339
+ onManageUnits: G,
340
+ onRemove: () => q(e.id)
341
+ }, e.id))]
342
+ }),
343
+ /* @__PURE__ */ D(n, {
344
+ type: "button",
345
+ variant: "ghost",
346
+ className: "ttw:w-fit ttw:text-primary ttw:hover:text-primary",
347
+ onClick: K,
348
+ children: [/* @__PURE__ */ E(k, { className: "ttw:size-5 ttw:text-primary" }), Z.addLineItemButton]
349
+ })
350
+ ]
351
+ }),
352
+ /* @__PURE__ */ E(T, {
353
+ idPrefix: Q,
354
+ openingNote: C.openingNote,
355
+ closingNote: C.closingNote,
356
+ openingNoteError: O?.openingNote,
357
+ closingNoteError: O?.closingNote,
358
+ disabled: z,
359
+ onOpeningNoteChange: (e) => V({ openingNote: e }),
360
+ onClosingNoteChange: (e) => V({ closingNote: e }),
361
+ labels: Z
362
+ })
89
363
  ]
90
364
  })
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
- ] })
365
+ }),
366
+ /* @__PURE__ */ E(v, { children: /* @__PURE__ */ D("div", {
367
+ className: "ttw:flex ttw:justify-end ttw:gap-2",
368
+ children: [/* @__PURE__ */ E(n, {
369
+ type: "button",
370
+ variant: "ghost",
371
+ onClick: Y,
372
+ children: Z.cancelButton
373
+ }), /* @__PURE__ */ E(n, {
374
+ type: "submit",
375
+ form: Q,
376
+ loading: z,
377
+ disabled: R,
378
+ children: o === "edit" ? Z.updateButton : Z.createButton
379
+ })]
380
+ }) })
381
+ ]
382
+ })
103
383
  });
104
384
  }
105
385
  //#endregion
106
- export { g as ReceivablePaymentDialog, g as default };
386
+ export { F as ReceivableFormSheet, F as default };
@@ -1,93 +1,106 @@
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, Textarea as l } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { RECEIVABLE_SEND_DIALOG_LABELS_EN as u } from "./index2.js";
3
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
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 "./index2.js";
3
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
4
4
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js
5
- function p({ message: e }) {
6
- return e ? /* @__PURE__ */ d("p", {
5
+ function h({ message: e }) {
6
+ return e ? /* @__PURE__ */ p("p", {
7
7
  className: "ttw:text-sm ttw:text-destructive",
8
8
  children: e
9
9
  }) : null;
10
10
  }
11
- function m({ open: m, onOpenChange: h, values: g, errors: _, inProgress: v, onChange: y, onSubmit: b, onCancel: x, labels: S }) {
12
- let C = {
13
- ...u,
14
- ...S
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
15
  };
16
- return /* @__PURE__ */ d(t, {
17
- open: m,
18
- onOpenChange: h,
19
- children: /* @__PURE__ */ f(n, { children: [
20
- /* @__PURE__ */ f(a, { children: [/* @__PURE__ */ d(o, { children: C.title }), /* @__PURE__ */ d(r, { children: C.description })] }),
21
- /* @__PURE__ */ f("div", {
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
22
  className: "ttw:flex ttw:flex-col ttw:gap-4",
23
23
  children: [
24
- _?.form && /* @__PURE__ */ d("p", {
24
+ y?.form && /* @__PURE__ */ p("p", {
25
25
  className: "ttw:rounded-md ttw:bg-destructive/10 ttw:px-3 ttw:py-2 ttw:text-sm ttw:text-destructive",
26
- children: _.form
26
+ children: y.form
27
27
  }),
28
- /* @__PURE__ */ f("div", {
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
+ })]
54
+ }),
55
+ v.mode === "partial" && /* @__PURE__ */ m("div", {
29
56
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
30
57
  children: [
31
- /* @__PURE__ */ d(c, { children: C.toLabel }),
32
- /* @__PURE__ */ d(s, {
33
- value: g.to,
34
- onChange: (e) => y({ to: e.target.value })
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 })
35
63
  }),
36
- /* @__PURE__ */ d(p, { message: _?.to })
64
+ /* @__PURE__ */ p(h, { message: y?.amountPaid })
37
65
  ]
38
66
  }),
39
- /* @__PURE__ */ f("div", {
40
- className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
41
- children: [/* @__PURE__ */ f("div", {
42
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
43
- children: [/* @__PURE__ */ d(c, { children: C.ccLabel }), /* @__PURE__ */ d(s, {
44
- value: g.cc,
45
- onChange: (e) => y({ cc: e.target.value })
46
- })]
47
- }), /* @__PURE__ */ f("div", {
48
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
49
- children: [/* @__PURE__ */ d(c, { children: C.bccLabel }), /* @__PURE__ */ d(s, {
50
- value: g.bcc,
51
- onChange: (e) => y({ bcc: e.target.value })
52
- })]
53
- })]
54
- }),
55
- /* @__PURE__ */ f("div", {
67
+ v.mode === "full" && /* @__PURE__ */ m("div", {
56
68
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
57
69
  children: [
58
- /* @__PURE__ */ d(c, { children: C.subjectLabel }),
59
- /* @__PURE__ */ d(s, {
60
- value: g.subject,
61
- onChange: (e) => y({ subject: e.target.value })
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 })
62
75
  }),
63
- /* @__PURE__ */ d(p, { message: _?.subject })
76
+ /* @__PURE__ */ p(h, { message: y?.paidAt })
64
77
  ]
65
78
  }),
66
- /* @__PURE__ */ f("div", {
79
+ /* @__PURE__ */ m("div", {
67
80
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
68
81
  children: [
69
- /* @__PURE__ */ d(c, { children: C.bodyLabel }),
70
- /* @__PURE__ */ d(l, {
71
- rows: 6,
72
- value: g.body,
73
- onChange: (e) => y({ body: e.target.value })
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 })
74
87
  }),
75
- /* @__PURE__ */ d(p, { message: _?.body })
88
+ /* @__PURE__ */ p(h, { message: y?.comment })
76
89
  ]
77
90
  })
78
91
  ]
79
92
  }),
80
- /* @__PURE__ */ f(i, { children: [/* @__PURE__ */ d(e, {
93
+ /* @__PURE__ */ m(i, { children: [/* @__PURE__ */ p(e, {
81
94
  variant: "ghost",
82
- onClick: x,
83
- children: C.cancelButton
84
- }), /* @__PURE__ */ d(e, {
85
- loading: v,
86
- onClick: b,
87
- children: C.sendButton
95
+ onClick: C,
96
+ children: T.cancelButton
97
+ }), /* @__PURE__ */ p(e, {
98
+ loading: b,
99
+ onClick: S,
100
+ children: T.submitButton
88
101
  })] })
89
102
  ] })
90
103
  });
91
104
  }
92
105
  //#endregion
93
- export { m as ReceivableSendDialog, m as default };
106
+ export { g as ReceivablePaymentDialog, g as default };