@tesouro/embedded-components-react 0.5.214 → 0.5.215

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 (74) hide show
  1. package/dist/index.d.ts +88 -1
  2. package/dist/index.js +1 -1
  3. package/dist/lib/ReceivablesWidget.d.ts +88 -1
  4. package/dist/lib/ReceivablesWidget.js +1 -1
  5. package/dist/libs/shared/util-validation/dist/index5.js +7 -0
  6. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +7 -7
  7. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js +63 -67
  8. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +160 -1
  9. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index12.js +6 -0
  10. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index2.js +32 -25
  11. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js +25 -200
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index7.js +175 -1
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index8.js +1 -101
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index9.js +92 -71
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js +1 -1
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index10.js +44 -100
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js +93 -421
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +442 -112
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +166 -157
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +150 -204
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +202 -31
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +32 -145
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +145 -37
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +44 -58
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +113 -87
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js +58 -116
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +83 -357
  28. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js +111 -65
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +449 -99
  30. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index24.js +68 -281
  31. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index25.js +115 -0
  32. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index26.js +314 -0
  33. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js +1 -1
  34. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index6.js +34 -23
  35. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js +444 -92
  36. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +113 -52
  37. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +18 -14
  38. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js +2 -92
  39. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +95 -3
  40. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +3 -24
  41. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +24 -1
  42. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +1 -3
  43. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +1 -1
  44. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +3 -18
  45. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +18 -1
  46. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +0 -3
  47. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +0 -8
  48. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +11 -0
  49. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +1 -264
  50. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +258 -42
  51. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +38 -62
  52. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +61 -463
  53. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +457 -89
  54. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +91 -234
  55. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +89 -82
  56. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +22 -338
  57. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +236 -0
  58. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index3.js +26 -204
  59. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +3 -0
  60. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +249 -0
  61. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +93 -0
  62. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +344 -0
  63. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +208 -32
  64. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index5.js +29 -202
  65. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +183 -137
  66. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +157 -12
  67. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index8.js +10 -19
  68. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +23 -2
  69. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +40 -40
  70. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +167 -156
  71. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +66 -34
  72. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  73. package/dist/packages/shared-ui-shadcn/dist/index.js +13 -13
  74. 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 te, Typography as E, cn as D } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { RECEIVABLE_FORM_SHEET_LABELS_EN as ne } from "./index4.js";
3
+ import { ReceivableFormTotals as O } from "./index23.js";
4
+ import { ReceivableNotesSection as k } from "./index24.js";
5
+ import { useId as re } from "react";
6
+ import { jsx as A, jsxs as j } from "react/jsx-runtime";
7
+ import { MinusIcon as M, PlusIcon as N, Trash2Icon as P } from "lucide-react";
4
8
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js
5
- function h({ message: e }) {
6
- return e ? /* @__PURE__ */ p("p", {
9
+ var F = "__none__", I = "__manage__";
10
+ function L({ message: e }) {
11
+ return e ? /* @__PURE__ */ A("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 ie({ 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__ */ j("li", {
19
+ className: "ttw:flex ttw:h-9 ttw:items-center ttw:gap-2.5",
20
+ children: [
21
+ /* @__PURE__ */ A("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__ */ j("div", {
30
+ className: D("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__ */ A("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__ */ A(M, { 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__ */ A("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__ */ A("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__ */ A(N, { className: "ttw:size-3.5" })
58
+ })
59
+ ]
60
+ }),
61
+ /* @__PURE__ */ j(h, {
62
+ value: t.unit || F,
63
+ onValueChange: (e) => {
64
+ if (e === I) {
65
+ C?.();
66
+ return;
67
+ }
68
+ b({ unit: e === F ? "" : e });
69
+ },
70
+ children: [/* @__PURE__ */ A(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__ */ A(y, {
76
+ className: "ttw:truncate",
77
+ placeholder: p.unitPlaceholder
78
+ })
79
+ }), /* @__PURE__ */ j(g, { children: [
80
+ C && /* @__PURE__ */ j(_, {
81
+ value: I,
82
+ className: "ttw:font-semibold ttw:text-primary ttw:hover:text-primary ttw:focus:text-primary",
83
+ children: [/* @__PURE__ */ A(N, { 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__ */ A(_, {
86
+ value: F,
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__ */ A(_, {
90
+ value: e.value,
91
+ children: e.label
92
+ }, e.value))
93
+ ] })]
94
+ }),
95
+ /* @__PURE__ */ j(l, {
96
+ className: "ttw:w-full ttw:max-w-41 ttw:min-w-29",
97
+ children: [/* @__PURE__ */ A(u, {
98
+ align: "inline-start",
99
+ children: f
100
+ }), /* @__PURE__ */ A(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__ */ A("div", {
114
+ className: "ttw:flex ttw:w-12 ttw:min-w-12 ttw:items-center ttw:justify-center",
115
+ children: /* @__PURE__ */ A(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__ */ A(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__ */ A(P, {})
130
+ })
131
+ ]
132
+ });
133
+ }
134
+ function ae({ 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__ */ j(i, {
145
+ className: "ttw:flex-col",
146
+ children: [/* @__PURE__ */ j(a, {
147
+ className: "ttw:flex-row ttw:items-center ttw:justify-end",
148
+ children: [/* @__PURE__ */ A(s, {
149
+ htmlFor: e,
150
+ className: D(r && "ttw:text-destructive"),
151
+ children: p.discountLabel
152
+ }), /* @__PURE__ */ j(l, {
153
+ className: "ttw:w-40 ttw:overflow-hidden",
154
+ children: [/* @__PURE__ */ A(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__ */ A("button", {
158
+ type: "button",
159
+ "aria-label": e.ariaLabel,
160
+ "aria-pressed": t === e.type,
161
+ disabled: f,
162
+ className: D("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__ */ A(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__ */ A(o, {
181
+ id: v,
182
+ className: "ttw:text-right",
183
+ children: r
184
+ })]
185
+ });
186
+ }
187
+ function R({ open: r, onOpenChange: o, mode: M = "create", values: P, errors: F, currencyOptions: I, unitOptions: R, currencySymbol: z, lineItemControls: B, autoFocusLineItemId: V, lineItemsLoading: H, inProgress: U, customerSelector: W, renderProductSelector: G, onChange: K, onLineItemChange: q, onLineItemCommit: J, 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, submitLabel: ye, onSubmit: be, onCancel: xe, labels: Se }) {
188
+ let Z = {
189
+ ...ne,
190
+ ...Se
191
+ }, Q = re(), $ = M === "edit", Ce = D("ttw:grid ttw:gap-4", $ && X ? "ttw:grid-cols-3" : "ttw:grid-cols-2");
192
+ return /* @__PURE__ */ A(x, {
193
+ open: r,
194
+ onOpenChange: o,
195
+ children: /* @__PURE__ */ j(S, {
196
+ className: "ttw:w-180 ttw:overflow-y-auto ttw:sm:max-w-180",
197
+ children: [
198
+ /* @__PURE__ */ j(T, { children: [/* @__PURE__ */ A(ee, { children: M === "edit" ? Z.editTitle : Z.createTitle }), /* @__PURE__ */ A(C, {
199
+ className: "ttw:sr-only",
200
+ children: Z.hiddenDescription
201
+ })] }),
202
+ /* @__PURE__ */ A("form", {
203
+ id: Q,
204
+ onSubmit: (e) => {
205
+ e.preventDefault(), e.stopPropagation(), be();
206
+ },
207
+ children: /* @__PURE__ */ j("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
+ F?.form && /* @__PURE__ */ A("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: F.form
214
+ }),
215
+ /* @__PURE__ */ j("div", {
216
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
217
+ children: [
218
+ /* @__PURE__ */ A(f, { children: Z.documentTypeLabel }),
219
+ /* @__PURE__ */ j(p, {
220
+ className: "ttw:flex ttw:flex-row ttw:gap-6",
221
+ disabled: M === "edit",
222
+ value: P.type,
223
+ onValueChange: (e) => K({ type: e }),
224
+ children: [/* @__PURE__ */ j("div", {
225
+ className: "ttw:flex ttw:items-center ttw:gap-2",
226
+ children: [/* @__PURE__ */ A(m, {
227
+ value: "invoice",
228
+ id: `${Q}-invoice`
229
+ }), /* @__PURE__ */ A(f, {
230
+ htmlFor: `${Q}-invoice`,
231
+ children: Z.typeInvoice
232
+ })]
233
+ }), /* @__PURE__ */ j("div", {
234
+ className: "ttw:flex ttw:items-center ttw:gap-2",
235
+ children: [/* @__PURE__ */ A(m, {
236
+ value: "quote",
237
+ id: `${Q}-quote`
238
+ }), /* @__PURE__ */ A(f, {
239
+ htmlFor: `${Q}-quote`,
240
+ children: Z.typeQuote
241
+ })]
242
+ })]
243
+ }),
244
+ /* @__PURE__ */ A(L, { message: F?.type })
245
+ ]
246
+ }),
247
+ /* @__PURE__ */ j("div", {
248
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
249
+ children: [
250
+ /* @__PURE__ */ A(f, { children: Z.customerLabel }),
251
+ W,
252
+ /* @__PURE__ */ A("p", {
253
+ className: "ttw:text-xs ttw:text-muted-foreground",
254
+ children: Z.customerHint
255
+ }),
256
+ /* @__PURE__ */ A(L, { message: F?.customerId })
257
+ ]
87
258
  }),
88
- /* @__PURE__ */ p(h, { message: y?.comment })
259
+ /* @__PURE__ */ j("div", {
260
+ className: Ce,
261
+ children: [
262
+ /* @__PURE__ */ j("div", {
263
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
264
+ children: [
265
+ /* @__PURE__ */ A(f, {
266
+ htmlFor: `${Q}-currency`,
267
+ children: Z.currencyLabel
268
+ }),
269
+ /* @__PURE__ */ j(h, {
270
+ value: P.currency,
271
+ onValueChange: (e) => K({ currency: e }),
272
+ children: [/* @__PURE__ */ A(v, {
273
+ id: `${Q}-currency`,
274
+ children: /* @__PURE__ */ A(y, {})
275
+ }), /* @__PURE__ */ A(g, { children: I.map((e) => /* @__PURE__ */ A(_, {
276
+ value: e.value,
277
+ children: e.label
278
+ }, e.value)) })]
279
+ }),
280
+ /* @__PURE__ */ A(L, { message: F?.currency })
281
+ ]
282
+ }),
283
+ $ && /* @__PURE__ */ j("div", {
284
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
285
+ children: [
286
+ /* @__PURE__ */ A(f, {
287
+ htmlFor: `${Q}-issue-date`,
288
+ children: Z.issueDateLabel
289
+ }),
290
+ /* @__PURE__ */ A(c, {
291
+ id: `${Q}-issue-date`,
292
+ type: "date",
293
+ value: P.issueDate,
294
+ onChange: (e) => K({ issueDate: e.target.value })
295
+ }),
296
+ /* @__PURE__ */ A(L, { message: F?.issueDate })
297
+ ]
298
+ }),
299
+ X && /* @__PURE__ */ j("div", {
300
+ className: "ttw:flex ttw:flex-col ttw:gap-1.5",
301
+ children: [
302
+ /* @__PURE__ */ A(f, {
303
+ htmlFor: `${Q}-due-date`,
304
+ children: Z.dueDateLabel
305
+ }),
306
+ /* @__PURE__ */ A(c, {
307
+ id: `${Q}-due-date`,
308
+ type: "date",
309
+ value: P.dueDate,
310
+ onChange: (e) => K({ dueDate: e.target.value })
311
+ }),
312
+ /* @__PURE__ */ A(L, { message: F?.dueDate })
313
+ ]
314
+ })
315
+ ]
316
+ }),
317
+ pe,
318
+ me,
319
+ /* @__PURE__ */ j("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__ */ j("div", {
323
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:pb-4",
324
+ children: [/* @__PURE__ */ A(E, {
325
+ variant: "h4",
326
+ children: Z.lineItemsHeading
327
+ }), /* @__PURE__ */ A(E, {
328
+ variant: "body2",
329
+ color: "muted",
330
+ className: "ttw:font-medium",
331
+ children: Z.lineItemsDescription
332
+ })]
333
+ }),
334
+ F?.lineItemsSummary?.length ? /* @__PURE__ */ A(e, {
335
+ variant: "destructive",
336
+ className: "ttw:mb-2",
337
+ children: /* @__PURE__ */ A(t, { children: /* @__PURE__ */ A("ul", { children: F.lineItemsSummary.map((e) => /* @__PURE__ */ A("li", { children: e }, e)) }) })
338
+ }) : null,
339
+ /* @__PURE__ */ j("ul", {
340
+ className: "ttw:flex ttw:flex-col ttw:gap-2.5",
341
+ children: [/* @__PURE__ */ j("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__ */ A("span", {
346
+ className: "ttw:inline-flex ttw:min-w-30 ttw:flex-1 ttw:whitespace-nowrap",
347
+ children: Z.productLabel
348
+ }),
349
+ /* @__PURE__ */ A("span", {
350
+ className: "ttw:w-24 ttw:min-w-24",
351
+ children: Z.quantityLabel
352
+ }),
353
+ /* @__PURE__ */ A("span", {
354
+ className: "ttw:w-20.5 ttw:min-w-20.5",
355
+ children: Z.unitLabel
356
+ }),
357
+ /* @__PURE__ */ A("span", {
358
+ className: "ttw:w-full ttw:max-w-41 ttw:min-w-29",
359
+ children: Z.priceLabel
360
+ }),
361
+ /* @__PURE__ */ A("span", {
362
+ className: "ttw:w-12 ttw:min-w-12",
363
+ children: Z.taxableLabel
364
+ }),
365
+ P.lineItems.length > 1 && /* @__PURE__ */ A("span", { className: "ttw:w-10 ttw:min-w-10" })
366
+ ]
367
+ }), H ? /* @__PURE__ */ A("li", {
368
+ className: "ttw:flex ttw:h-9 ttw:items-center ttw:justify-center",
369
+ children: /* @__PURE__ */ A(te, { className: "ttw:size-5" })
370
+ }) : P.lineItems.map((e) => /* @__PURE__ */ A(ie, {
371
+ formId: Q,
372
+ lineItem: e,
373
+ errors: F?.lineItems?.[e.id],
374
+ controls: B?.[e.id],
375
+ focusOnMount: e.id === V,
376
+ canRemove: P.lineItems.length > 1,
377
+ unitOptions: R,
378
+ currencySymbol: z,
379
+ labels: Z,
380
+ renderProductSelector: G,
381
+ onChange: (t) => q(e.id, t),
382
+ onCommit: (t) => J(e.id, t),
383
+ onQuantityStep: (t) => Y(e.id, t),
384
+ onManageUnits: ue,
385
+ onRemove: () => fe(e.id)
386
+ }, e.id))]
387
+ }),
388
+ /* @__PURE__ */ j(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__ */ A(N, { className: "ttw:size-5 ttw:text-primary" }), Z.addLineItemButton]
394
+ }),
395
+ /* @__PURE__ */ A(ae, {
396
+ inputId: `${Q}-discount`,
397
+ discountType: P.discountType,
398
+ value: P.discount,
399
+ error: F?.discount,
400
+ currencySymbol: z,
401
+ disabled: U,
402
+ labels: Z,
403
+ onChange: (e) => K({ discount: e }),
404
+ onTypeChange: (e) => K({ discountType: e }),
405
+ onFocus: se,
406
+ onBlur: ce
407
+ }),
408
+ /* @__PURE__ */ A(i, { children: /* @__PURE__ */ j(a, {
409
+ className: "ttw:flex-row ttw:justify-end",
410
+ children: [/* @__PURE__ */ A(s, {
411
+ htmlFor: `${Q}-tax-rate`,
412
+ children: Z.taxRateLabel
413
+ }), /* @__PURE__ */ j(l, {
414
+ className: "ttw:w-40 ttw:has-[>[data-align=inline-end]]:[&>input]:pr-0",
415
+ children: [/* @__PURE__ */ A(d, {
416
+ id: `${Q}-tax-rate`,
417
+ className: "ttw:text-right",
418
+ placeholder: Z.taxRatePlaceholder,
419
+ type: "text",
420
+ inputMode: "decimal",
421
+ value: P.taxRate,
422
+ onChange: (e) => K({ taxRate: e.target.value }),
423
+ onBlur: oe
424
+ }), /* @__PURE__ */ A(u, {
425
+ align: "inline-end",
426
+ children: Z.taxRateSuffix
427
+ })]
428
+ })]
429
+ }) }),
430
+ /* @__PURE__ */ A(b, {}),
431
+ /* @__PURE__ */ A(O, {
432
+ totals: le,
433
+ labels: Z
434
+ })
435
+ ]
436
+ }),
437
+ he,
438
+ /* @__PURE__ */ A(k, {
439
+ idPrefix: Q,
440
+ openingNote: P.openingNote,
441
+ closingNote: P.closingNote,
442
+ openingNoteError: F?.openingNote,
443
+ closingNoteError: F?.closingNote,
444
+ disabled: U,
445
+ onOpeningNoteChange: (e) => K({ openingNote: e }),
446
+ onClosingNoteChange: (e) => K({ 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__ */ A(w, { children: /* @__PURE__ */ j("div", {
454
+ className: "ttw:flex ttw:justify-end ttw:gap-2",
455
+ children: [/* @__PURE__ */ A(n, {
456
+ type: "button",
457
+ variant: "ghost",
458
+ disabled: _e,
459
+ onClick: xe,
460
+ children: Z.cancelButton
461
+ }), /* @__PURE__ */ A(n, {
462
+ type: "submit",
463
+ form: Q,
464
+ loading: U,
465
+ disabled: ve,
466
+ children: ye ?? (M === "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 { R as ReceivableFormSheet, R as default };