@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.
- package/dist/index.d.ts +88 -1
- package/dist/index.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +88 -1
- package/dist/lib/ReceivablesWidget.js +1 -1
- package/dist/libs/shared/util-validation/dist/index5.js +7 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js +63 -67
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +160 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index12.js +6 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index2.js +32 -25
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js +25 -200
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index7.js +175 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index8.js +1 -101
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index9.js +92 -71
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index10.js +44 -100
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js +93 -421
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +442 -112
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +166 -157
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +150 -204
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +202 -31
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +32 -145
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +145 -37
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +44 -58
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +113 -87
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js +58 -116
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +83 -357
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js +111 -65
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +449 -99
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index24.js +68 -281
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index25.js +115 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index26.js +314 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index6.js +34 -23
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js +444 -92
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +113 -52
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +18 -14
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js +2 -92
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +95 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +3 -24
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +24 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +1 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +3 -18
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +18 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +0 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +0 -8
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +11 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +1 -264
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +258 -42
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +38 -62
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +61 -463
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +457 -89
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +91 -234
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +89 -82
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +22 -338
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +236 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index3.js +26 -204
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +249 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +93 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +344 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +208 -32
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index5.js +29 -202
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +183 -137
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +157 -12
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index8.js +10 -19
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +23 -2
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +40 -40
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +167 -156
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +66 -34
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/packages/shared-ui-shadcn/dist/index.js +13 -13
- package/package.json +1 -1
|
@@ -1,72 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { jsx as
|
|
1
|
+
import { cn as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
3
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js
|
|
4
|
-
function
|
|
5
|
-
return /* @__PURE__ */
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
children: [p, /* @__PURE__ */ s(o, {
|
|
10
|
-
variant: "body2",
|
|
11
|
-
component: "span",
|
|
12
|
-
color: "muted",
|
|
13
|
-
className: "ttw:leading-snug",
|
|
14
|
-
children: m
|
|
15
|
-
})]
|
|
16
|
-
}),
|
|
17
|
-
/* @__PURE__ */ s(a, {
|
|
18
|
-
id: l,
|
|
19
|
-
value: u,
|
|
20
|
-
disabled: f,
|
|
21
|
-
placeholder: h,
|
|
22
|
-
className: "ttw:h-26 ttw:resize-none",
|
|
23
|
-
"aria-invalid": !!d,
|
|
24
|
-
onChange: (e) => _(e.target.value)
|
|
25
|
-
}),
|
|
26
|
-
/* @__PURE__ */ s(n, { children: g }),
|
|
27
|
-
/* @__PURE__ */ s(r, { errors: d ? [{ message: d }] : [] })
|
|
28
|
-
] }) });
|
|
4
|
+
function r({ label: r, value: i, className: a }) {
|
|
5
|
+
return /* @__PURE__ */ n("li", {
|
|
6
|
+
className: e("ttw:flex ttw:items-center ttw:justify-between", a),
|
|
7
|
+
children: [/* @__PURE__ */ t("span", { children: r }), /* @__PURE__ */ t("span", { children: i })]
|
|
8
|
+
});
|
|
29
9
|
}
|
|
30
|
-
function
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
-
className: "ttw:flex ttw:
|
|
10
|
+
function i({ totals: e, labels: i }) {
|
|
11
|
+
return /* @__PURE__ */ n("ul", {
|
|
12
|
+
className: "ttw:flex ttw:w-full ttw:list-none ttw:flex-col ttw:gap-1.5",
|
|
33
13
|
children: [
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
14
|
+
/* @__PURE__ */ t(r, {
|
|
15
|
+
label: i.subtotalLabel,
|
|
16
|
+
value: e.subtotal,
|
|
17
|
+
className: "ttw:text-sm ttw:font-normal"
|
|
18
|
+
}),
|
|
19
|
+
/* @__PURE__ */ t(r, {
|
|
20
|
+
label: i.discountTotalLabel,
|
|
21
|
+
value: e.discount,
|
|
22
|
+
className: "ttw:text-sm ttw:font-normal"
|
|
23
|
+
}),
|
|
24
|
+
/* @__PURE__ */ t(r, {
|
|
25
|
+
label: i.nonTaxableSubtotalLabel,
|
|
26
|
+
value: e.nonTaxableSubtotal,
|
|
27
|
+
className: "ttw:text-sm ttw:font-normal ttw:text-muted-foreground"
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ t(r, {
|
|
30
|
+
label: i.taxableSubtotalLabel,
|
|
31
|
+
value: e.taxableSubtotal,
|
|
32
|
+
className: "ttw:text-sm ttw:font-normal ttw:text-muted-foreground"
|
|
45
33
|
}),
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
|
|
48
|
-
value:
|
|
49
|
-
|
|
50
|
-
disabled: a,
|
|
51
|
-
label: f.openingNoteLabel,
|
|
52
|
-
optionalSuffix: f.optionalSuffix,
|
|
53
|
-
placeholder: f.openingNotePlaceholder,
|
|
54
|
-
description: f.openingNoteDescription,
|
|
55
|
-
onChange: u
|
|
34
|
+
/* @__PURE__ */ t(r, {
|
|
35
|
+
label: i.taxTotalLabel,
|
|
36
|
+
value: e.tax,
|
|
37
|
+
className: "ttw:text-sm ttw:font-normal"
|
|
56
38
|
}),
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
|
|
59
|
-
value:
|
|
60
|
-
|
|
61
|
-
disabled: a,
|
|
62
|
-
label: f.closingNoteLabel,
|
|
63
|
-
optionalSuffix: f.optionalSuffix,
|
|
64
|
-
placeholder: f.closingNotePlaceholder,
|
|
65
|
-
description: f.closingNoteDescription,
|
|
66
|
-
onChange: d
|
|
39
|
+
/* @__PURE__ */ t(r, {
|
|
40
|
+
label: i.totalLabel,
|
|
41
|
+
value: e.total,
|
|
42
|
+
className: "ttw:text-lg ttw:font-medium"
|
|
67
43
|
})
|
|
68
44
|
]
|
|
69
45
|
});
|
|
70
46
|
}
|
|
71
47
|
//#endregion
|
|
72
|
-
export {
|
|
48
|
+
export { i as ReceivableFormTotals };
|
|
@@ -1,474 +1,72 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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";
|
|
1
|
+
import { Field as e, FieldContent as t, FieldDescription as n, FieldError as r, FieldLabel as i, Textarea as a, Typography as o } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
8
3
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
function l({ id: l, value: u, error: d, disabled: f, label: p, optionalSuffix: m, placeholder: h, description: g, onChange: _ }) {
|
|
5
|
+
return /* @__PURE__ */ s(e, { children: /* @__PURE__ */ c(t, { children: [
|
|
6
|
+
/* @__PURE__ */ c(i, {
|
|
7
|
+
htmlFor: l,
|
|
8
|
+
className: "ttw:text-nowrap",
|
|
9
|
+
children: [p, /* @__PURE__ */ s(o, {
|
|
10
|
+
variant: "body2",
|
|
11
|
+
component: "span",
|
|
12
|
+
color: "muted",
|
|
13
|
+
className: "ttw:leading-snug",
|
|
14
|
+
children: m
|
|
15
|
+
})]
|
|
16
|
+
}),
|
|
17
|
+
/* @__PURE__ */ s(a, {
|
|
18
|
+
id: l,
|
|
19
|
+
value: u,
|
|
20
|
+
disabled: f,
|
|
21
|
+
placeholder: h,
|
|
22
|
+
className: "ttw:h-26 ttw:resize-none",
|
|
23
|
+
"aria-invalid": !!d,
|
|
24
|
+
onChange: (e) => _(e.target.value)
|
|
25
|
+
}),
|
|
26
|
+
/* @__PURE__ */ s(n, { children: g }),
|
|
27
|
+
/* @__PURE__ */ s(r, { errors: d ? [{ message: d }] : [] })
|
|
28
|
+
] }) });
|
|
15
29
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
className: "ttw:flex ttw:h-9 ttw:items-center ttw:gap-2.5",
|
|
30
|
+
function u({ idPrefix: e, openingNote: t, closingNote: n, openingNoteError: r, closingNoteError: i, disabled: a, onOpeningNoteChange: u, onClosingNoteChange: d, labels: f }) {
|
|
31
|
+
return /* @__PURE__ */ c("div", {
|
|
32
|
+
className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:rounded-xl ttw:border ttw:border-border ttw:p-6",
|
|
20
33
|
children: [
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
-
className: "ttw:
|
|
23
|
-
children:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
children: [
|
|
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" })
|
|
39
|
-
}),
|
|
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")
|
|
50
|
-
}),
|
|
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]
|
|
84
|
-
}),
|
|
85
|
-
/* @__PURE__ */ j(_, {
|
|
86
|
-
value: I,
|
|
87
|
-
children: p.unitNone
|
|
88
|
-
}),
|
|
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")
|
|
34
|
+
/* @__PURE__ */ c("div", {
|
|
35
|
+
className: "ttw:flex ttw:flex-col ttw:gap-2.5 ttw:pb-4",
|
|
36
|
+
children: [/* @__PURE__ */ s(o, {
|
|
37
|
+
variant: "h4",
|
|
38
|
+
children: f.notesHeading
|
|
39
|
+
}), /* @__PURE__ */ s(o, {
|
|
40
|
+
variant: "body2",
|
|
41
|
+
color: "muted",
|
|
42
|
+
className: "ttw:font-medium",
|
|
43
|
+
children: f.notesDescription
|
|
111
44
|
})]
|
|
112
45
|
}),
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
46
|
+
/* @__PURE__ */ s(l, {
|
|
47
|
+
id: `${e}-opening-note`,
|
|
48
|
+
value: t,
|
|
49
|
+
error: r,
|
|
50
|
+
disabled: a,
|
|
51
|
+
label: f.openingNoteLabel,
|
|
52
|
+
optionalSuffix: f.optionalSuffix,
|
|
53
|
+
placeholder: f.openingNotePlaceholder,
|
|
54
|
+
description: f.openingNoteDescription,
|
|
55
|
+
onChange: u
|
|
121
56
|
}),
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
57
|
+
/* @__PURE__ */ s(l, {
|
|
58
|
+
id: `${e}-closing-note`,
|
|
59
|
+
value: n,
|
|
60
|
+
error: i,
|
|
61
|
+
disabled: a,
|
|
62
|
+
label: f.closingNoteLabel,
|
|
63
|
+
optionalSuffix: f.optionalSuffix,
|
|
64
|
+
placeholder: f.closingNotePlaceholder,
|
|
65
|
+
description: f.closingNoteDescription,
|
|
66
|
+
onChange: d
|
|
130
67
|
})
|
|
131
68
|
]
|
|
132
69
|
});
|
|
133
70
|
}
|
|
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",
|
|
209
|
-
children: [
|
|
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
|
-
]
|
|
258
|
-
}),
|
|
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
|
|
450
|
-
]
|
|
451
|
-
})
|
|
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
|
-
})
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
71
|
//#endregion
|
|
474
|
-
export {
|
|
72
|
+
export { u as ReceivableNotesSection };
|