@tesouro/embedded-components-react 0.7.64 → 0.7.67
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/README.md +1 -1
- package/dist/index.css +3 -0
- package/dist/index.d.ts +10 -10
- package/dist/lib/ProductsWidget.d.ts +40 -10
- package/dist/lib/ReceivablesWidget.d.ts +9 -9
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/apiValidationErrors.js +34 -63
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/currencyDisplay.js +6 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/discount.js +31 -30
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +89 -87
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/lineItems.js +84 -82
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/preview.js +77 -75
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/totals.js +54 -53
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +458 -457
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/ProductsWidget.js +0 -2
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/helpers.js +33 -41
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/labels.js +3 -4
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useProductForm.js +42 -44
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index2.js +14 -13
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index3.js +128 -147
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index4.js +109 -92
- package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/apiValidationErrors.js +33 -0
- package/package.json +1 -1
package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index4.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { Button as e, DropdownMenu as t, DropdownMenuContent as n, DropdownMenuItem as r, DropdownMenuTrigger as i, Input as a, InputGroup as o, InputGroupInput as s, Sheet as c, SheetContent as l, SheetDescription as u, SheetFooter as d, SheetHeader as f, SheetTitle as p, Table as m, TableBody as h, TableCell as g, TableHead as _, TableHeader as v, TableRow as y } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
2
|
import { MEASURE_UNITS_MANAGER_LABELS_EN as b } from "./index2.js";
|
|
3
3
|
import { jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
4
|
-
import { CheckIcon as C, MoreVerticalIcon as w, PencilIcon as T,
|
|
4
|
+
import { CheckIcon as C, MoreVerticalIcon as w, PencilIcon as T, Trash2Icon as E, XIcon as D } from "lucide-react";
|
|
5
5
|
//#region ../../libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index4.js
|
|
6
|
-
var
|
|
7
|
-
function
|
|
8
|
-
let
|
|
6
|
+
var O = "—";
|
|
7
|
+
function k({ open: k, onOpenChange: A, units: j, isLoading: M, searchValue: N, onSearchChange: P, createValues: F, createError: I, onCreateChange: L, onCreateSubmit: R, isCreating: z, editingUnitId: B, editValues: V, editError: H, onEditStart: U, onEditChange: W, onEditSubmit: G, onEditCancel: K, isUpdating: q, onDeleteClick: J, onDone: Y, labels: X }) {
|
|
8
|
+
let Z = {
|
|
9
9
|
...b,
|
|
10
|
-
...
|
|
10
|
+
...X
|
|
11
11
|
};
|
|
12
12
|
return /* @__PURE__ */ x(c, {
|
|
13
|
-
open:
|
|
14
|
-
onOpenChange:
|
|
13
|
+
open: k,
|
|
14
|
+
onOpenChange: A,
|
|
15
15
|
children: /* @__PURE__ */ S(l, {
|
|
16
16
|
className: "ttw:w-150 ttw:sm:max-w-150 ttw:gap-0 ttw:p-0",
|
|
17
17
|
children: [
|
|
18
18
|
/* @__PURE__ */ S(f, {
|
|
19
19
|
className: "ttw:border-b ttw:border-border",
|
|
20
|
-
children: [/* @__PURE__ */ x(p, { children:
|
|
20
|
+
children: [/* @__PURE__ */ x(p, { children: Z.title }), /* @__PURE__ */ x(u, {
|
|
21
21
|
className: "ttw:sr-only",
|
|
22
|
-
children:
|
|
22
|
+
children: Z.hiddenDescription
|
|
23
23
|
})]
|
|
24
24
|
}),
|
|
25
25
|
/* @__PURE__ */ S("div", {
|
|
26
26
|
className: "ttw:flex-1 ttw:flex ttw:flex-col ttw:gap-4 ttw:overflow-y-auto ttw:px-6 ttw:py-4",
|
|
27
27
|
children: [/* @__PURE__ */ x(o, { children: /* @__PURE__ */ x(s, {
|
|
28
|
-
placeholder:
|
|
29
|
-
value:
|
|
30
|
-
onChange: (e) =>
|
|
28
|
+
placeholder: Z.searchPlaceholder,
|
|
29
|
+
value: N,
|
|
30
|
+
onChange: (e) => P(e.target.value)
|
|
31
31
|
}) }), /* @__PURE__ */ S(m, {
|
|
32
32
|
className: "ttw:table-fixed ttw:border ttw:border-border ttw:rounded-md",
|
|
33
33
|
children: [/* @__PURE__ */ x(v, { children: /* @__PURE__ */ S(y, {
|
|
@@ -35,91 +35,105 @@ function A({ open: A, onOpenChange: j, units: M, isLoading: N, searchValue: P, o
|
|
|
35
35
|
children: [
|
|
36
36
|
/* @__PURE__ */ x(_, {
|
|
37
37
|
className: "ttw:w-[30%]",
|
|
38
|
-
children:
|
|
38
|
+
children: Z.columnLabel
|
|
39
39
|
}),
|
|
40
40
|
/* @__PURE__ */ x(_, {
|
|
41
41
|
className: "ttw:w-[50%]",
|
|
42
|
-
children:
|
|
42
|
+
children: Z.columnDescription
|
|
43
43
|
}),
|
|
44
44
|
/* @__PURE__ */ x(_, { className: "ttw:w-[20%]" })
|
|
45
45
|
]
|
|
46
46
|
}) }), /* @__PURE__ */ S(h, { children: [
|
|
47
47
|
/* @__PURE__ */ S(y, {
|
|
48
|
-
className: "ttw:border-border",
|
|
48
|
+
className: "ttw:hover:bg-transparent ttw:border-border",
|
|
49
49
|
children: [
|
|
50
|
-
/* @__PURE__ */ S(g, {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
disabled: B,
|
|
65
|
-
className: "ttw:h-8",
|
|
66
|
-
onChange: (e) => R({ description: e.target.value })
|
|
67
|
-
}) }),
|
|
50
|
+
/* @__PURE__ */ S(g, {
|
|
51
|
+
className: "ttw:align-top",
|
|
52
|
+
children: [/* @__PURE__ */ x(a, {
|
|
53
|
+
placeholder: Z.namePlaceholder,
|
|
54
|
+
value: F.name,
|
|
55
|
+
"aria-invalid": !!I,
|
|
56
|
+
disabled: z,
|
|
57
|
+
className: "ttw:h-8",
|
|
58
|
+
onChange: (e) => L({ name: e.target.value })
|
|
59
|
+
}), I && /* @__PURE__ */ x("p", {
|
|
60
|
+
className: "ttw:mt-1 ttw:text-sm ttw:text-destructive",
|
|
61
|
+
children: I
|
|
62
|
+
})]
|
|
63
|
+
}),
|
|
68
64
|
/* @__PURE__ */ x(g, {
|
|
69
|
-
className: "ttw:
|
|
70
|
-
children: /* @__PURE__ */
|
|
71
|
-
|
|
65
|
+
className: "ttw:align-top",
|
|
66
|
+
children: /* @__PURE__ */ x(a, {
|
|
67
|
+
placeholder: Z.descriptionPlaceholder,
|
|
68
|
+
value: F.description,
|
|
69
|
+
disabled: z,
|
|
70
|
+
className: "ttw:h-8",
|
|
71
|
+
onChange: (e) => L({ description: e.target.value })
|
|
72
|
+
})
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ x(g, {
|
|
75
|
+
className: "ttw:align-top ttw:text-right",
|
|
76
|
+
children: /* @__PURE__ */ x(e, {
|
|
77
|
+
variant: "secondary",
|
|
72
78
|
size: "sm",
|
|
73
|
-
onClick:
|
|
74
|
-
disabled:
|
|
75
|
-
|
|
76
|
-
children: [/* @__PURE__ */ x(E, { className: "ttw:size-4" }), Q.addButton]
|
|
79
|
+
onClick: R,
|
|
80
|
+
disabled: z,
|
|
81
|
+
children: Z.addButton
|
|
77
82
|
})
|
|
78
83
|
})
|
|
79
84
|
]
|
|
80
85
|
}),
|
|
81
|
-
|
|
82
|
-
className: "ttw:border-border",
|
|
86
|
+
M ? null : j.map((o) => B === o.id ? /* @__PURE__ */ S(y, {
|
|
87
|
+
className: "ttw:hover:bg-transparent ttw:border-border",
|
|
83
88
|
children: [
|
|
84
|
-
/* @__PURE__ */ S(g, {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
value: H.description,
|
|
96
|
-
disabled: J,
|
|
97
|
-
className: "ttw:h-8",
|
|
98
|
-
onChange: (e) => G({ description: e.target.value })
|
|
99
|
-
}) }),
|
|
100
|
-
/* @__PURE__ */ x(g, { children: /* @__PURE__ */ S("div", {
|
|
101
|
-
className: "ttw:flex ttw:justify-end ttw:gap-1",
|
|
102
|
-
children: [/* @__PURE__ */ x(e, {
|
|
103
|
-
variant: "outline",
|
|
104
|
-
size: "icon",
|
|
105
|
-
"aria-label": Q.saveAction,
|
|
106
|
-
onClick: K,
|
|
107
|
-
disabled: J,
|
|
108
|
-
className: "ttw:size-8 ttw:bg-primary-foreground ttw:text-primary ttw:hover:text-primary ttw:hover:bg-primary-foreground/80 ttw:border-0",
|
|
109
|
-
children: /* @__PURE__ */ x(C, { className: "ttw:size-4" })
|
|
110
|
-
}), /* @__PURE__ */ x(e, {
|
|
111
|
-
variant: "outline",
|
|
112
|
-
size: "icon",
|
|
113
|
-
"aria-label": Q.cancelAction,
|
|
114
|
-
onClick: q,
|
|
115
|
-
disabled: J,
|
|
116
|
-
className: "ttw:size-8 ttw:bg-primary-foreground ttw:text-primary ttw:hover:text-primary ttw:hover:bg-primary-foreground/80 ttw:border-0",
|
|
117
|
-
children: /* @__PURE__ */ x(O, { className: "ttw:size-4" })
|
|
89
|
+
/* @__PURE__ */ S(g, {
|
|
90
|
+
className: "ttw:align-top",
|
|
91
|
+
children: [/* @__PURE__ */ x(a, {
|
|
92
|
+
value: V.name,
|
|
93
|
+
"aria-invalid": !!H,
|
|
94
|
+
disabled: q,
|
|
95
|
+
className: "ttw:h-8",
|
|
96
|
+
onChange: (e) => W({ name: e.target.value })
|
|
97
|
+
}), H && /* @__PURE__ */ x("p", {
|
|
98
|
+
className: "ttw:mt-1 ttw:text-sm ttw:text-destructive",
|
|
99
|
+
children: H
|
|
118
100
|
})]
|
|
119
|
-
})
|
|
101
|
+
}),
|
|
102
|
+
/* @__PURE__ */ x(g, {
|
|
103
|
+
className: "ttw:align-top",
|
|
104
|
+
children: /* @__PURE__ */ x(a, {
|
|
105
|
+
value: V.description,
|
|
106
|
+
disabled: q,
|
|
107
|
+
className: "ttw:h-8",
|
|
108
|
+
onChange: (e) => W({ description: e.target.value })
|
|
109
|
+
})
|
|
110
|
+
}),
|
|
111
|
+
/* @__PURE__ */ x(g, {
|
|
112
|
+
className: "ttw:align-top",
|
|
113
|
+
children: /* @__PURE__ */ S("div", {
|
|
114
|
+
className: "ttw:flex ttw:justify-end ttw:gap-1",
|
|
115
|
+
children: [/* @__PURE__ */ x(e, {
|
|
116
|
+
variant: "outline",
|
|
117
|
+
size: "icon",
|
|
118
|
+
"aria-label": Z.saveAction,
|
|
119
|
+
onClick: G,
|
|
120
|
+
disabled: q,
|
|
121
|
+
className: "ttw:size-8 ttw:border-border",
|
|
122
|
+
children: /* @__PURE__ */ x(C, { className: "ttw:size-4" })
|
|
123
|
+
}), /* @__PURE__ */ x(e, {
|
|
124
|
+
variant: "outline",
|
|
125
|
+
size: "icon",
|
|
126
|
+
"aria-label": Z.cancelAction,
|
|
127
|
+
onClick: K,
|
|
128
|
+
disabled: q,
|
|
129
|
+
className: "ttw:size-8 ttw:border-border",
|
|
130
|
+
children: /* @__PURE__ */ x(D, { className: "ttw:size-4" })
|
|
131
|
+
})]
|
|
132
|
+
})
|
|
133
|
+
})
|
|
120
134
|
]
|
|
121
135
|
}, o.id) : /* @__PURE__ */ S(y, {
|
|
122
|
-
className: "ttw:border-border",
|
|
136
|
+
className: "ttw:hover:bg-transparent ttw:border-border",
|
|
123
137
|
children: [
|
|
124
138
|
/* @__PURE__ */ x(g, {
|
|
125
139
|
className: "ttw:text-sm ttw:truncate",
|
|
@@ -127,7 +141,7 @@ function A({ open: A, onOpenChange: j, units: M, isLoading: N, searchValue: P, o
|
|
|
127
141
|
}),
|
|
128
142
|
/* @__PURE__ */ x(g, {
|
|
129
143
|
className: "ttw:text-sm ttw:text-muted-foreground ttw:truncate",
|
|
130
|
-
children: o.description ||
|
|
144
|
+
children: o.description || O
|
|
131
145
|
}),
|
|
132
146
|
/* @__PURE__ */ x(g, {
|
|
133
147
|
className: "ttw:text-right",
|
|
@@ -136,36 +150,39 @@ function A({ open: A, onOpenChange: j, units: M, isLoading: N, searchValue: P, o
|
|
|
136
150
|
children: /* @__PURE__ */ x(e, {
|
|
137
151
|
variant: "ghost",
|
|
138
152
|
size: "icon-sm",
|
|
139
|
-
"aria-label":
|
|
153
|
+
"aria-label": Z.moreActionsLabel,
|
|
140
154
|
children: /* @__PURE__ */ x(w, { className: "ttw:size-4" })
|
|
141
155
|
})
|
|
142
156
|
}), /* @__PURE__ */ S(n, {
|
|
143
157
|
align: "end",
|
|
144
158
|
children: [/* @__PURE__ */ S(r, {
|
|
145
|
-
onClick: () =>
|
|
146
|
-
children: [/* @__PURE__ */ x(T, { className: "ttw:size-4" }),
|
|
159
|
+
onClick: () => U(o),
|
|
160
|
+
children: [/* @__PURE__ */ x(T, { className: "ttw:size-4" }), Z.editAction]
|
|
147
161
|
}), /* @__PURE__ */ S(r, {
|
|
148
|
-
onClick: () =>
|
|
162
|
+
onClick: () => J(o),
|
|
149
163
|
variant: "destructive",
|
|
150
|
-
children: [/* @__PURE__ */ x(
|
|
164
|
+
children: [/* @__PURE__ */ x(E, { className: "ttw:size-4" }), Z.deleteAction]
|
|
151
165
|
})]
|
|
152
166
|
})] })
|
|
153
167
|
})
|
|
154
168
|
]
|
|
155
169
|
}, o.id)),
|
|
156
|
-
!
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
170
|
+
!M && j.length === 0 && /* @__PURE__ */ x(y, {
|
|
171
|
+
className: "ttw:hover:bg-transparent",
|
|
172
|
+
children: /* @__PURE__ */ x(g, {
|
|
173
|
+
colSpan: 3,
|
|
174
|
+
className: "ttw:text-center ttw:text-muted-foreground",
|
|
175
|
+
children: Z.emptyText
|
|
176
|
+
})
|
|
177
|
+
})
|
|
161
178
|
] })]
|
|
162
179
|
})]
|
|
163
180
|
}),
|
|
164
181
|
/* @__PURE__ */ x(d, {
|
|
165
182
|
className: "ttw:border-t ttw:border-border ttw:flex-row ttw:justify-end",
|
|
166
183
|
children: /* @__PURE__ */ x(e, {
|
|
167
|
-
onClick:
|
|
168
|
-
children:
|
|
184
|
+
onClick: Y,
|
|
185
|
+
children: Z.doneButton
|
|
169
186
|
})
|
|
170
187
|
})
|
|
171
188
|
]
|
|
@@ -173,4 +190,4 @@ function A({ open: A, onOpenChange: j, units: M, isLoading: N, searchValue: P, o
|
|
|
173
190
|
});
|
|
174
191
|
}
|
|
175
192
|
//#endregion
|
|
176
|
-
export {
|
|
193
|
+
export { k as MeasureUnitsManager, k as default };
|
package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/apiValidationErrors.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region ../../libs/tesouro-embedded-components-react/shared/util/dist/lib/apiValidationErrors.js
|
|
2
|
+
var e = (e) => typeof e == "number" || /^\d+$/.test(e), t = (e) => /^[A-Z]/.test(e) || e.includes("[") || e.includes("-"), n = (n) => n.filter((e, t) => t !== 0 || e !== "body").filter((n) => e(n) || !t(String(n))).join("."), r = (e) => typeof e == "string" || typeof e == "number", i = (e, t) => e === t || RegExp(`(^|[^A-Za-z0-9_])${t}([^A-Za-z0-9_]|$)`).test(e), a = (e) => typeof e == "object" && !!e;
|
|
3
|
+
function o(e) {
|
|
4
|
+
if (typeof e == "string") return e.trim() ? {
|
|
5
|
+
path: "",
|
|
6
|
+
loc: [],
|
|
7
|
+
msg: e,
|
|
8
|
+
type: ""
|
|
9
|
+
} : null;
|
|
10
|
+
if (!a(e)) return null;
|
|
11
|
+
let { loc: t, msg: i, type: o } = e;
|
|
12
|
+
if (typeof i != "string" || !i.trim()) return null;
|
|
13
|
+
let s = Array.isArray(t) ? t.filter(r) : [];
|
|
14
|
+
return {
|
|
15
|
+
path: n(s),
|
|
16
|
+
loc: s,
|
|
17
|
+
msg: i,
|
|
18
|
+
type: typeof o == "string" ? o : ""
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function s(e, t = []) {
|
|
22
|
+
if (!a(e) || !Array.isArray(e.detail)) return [];
|
|
23
|
+
let n = [], r = /* @__PURE__ */ new Set();
|
|
24
|
+
for (let a of e.detail) {
|
|
25
|
+
let e = o(a);
|
|
26
|
+
if (!e || e.loc.some((e) => typeof e == "string" && t.some((t) => i(e, t)))) continue;
|
|
27
|
+
let s = `${e.path}:${e.msg}`;
|
|
28
|
+
r.has(s) || (r.add(s), n.push(e));
|
|
29
|
+
}
|
|
30
|
+
return n;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { s as parseApiValidationErrors };
|