@tesouro/embedded-components-react 0.7.72 → 0.7.74
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 +9 -0
- package/dist/index.d.ts +12 -6
- package/dist/lib/ProductsWidget.d.ts +12 -6
- package/dist/lib/ReceivablesWidget.d.ts +1 -5
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/ProductsWidget.js +23 -24
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/constants.js +6 -2
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/useProductsTable.js +112 -51
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/useProductsWidget.js +80 -56
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index.js +6 -5
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index2.js +15 -6
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index4.js +170 -135
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index5.js +49 -150
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index6.js +152 -24
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index7.js +28 -0
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/labels.js +1 -2
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/policyViewModel.js +8 -9
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/useApprovalPolicyRules.js +127 -141
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/util/dist/lib/validatePolicyDraft.js +1 -1
- 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/index.js +13 -12
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/ProductSelector.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/helpers.js +41 -27
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useProductForm.js +70 -52
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index.js +7 -6
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index2.js +19 -8
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index3.js +171 -218
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index4.js +52 -180
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index5.js +188 -46
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index6.js +47 -124
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index7.js +128 -0
- package/package.json +1 -1
|
@@ -1,28 +1,156 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { Button as e, DropdownMenu as t, DropdownMenuContent as n, DropdownMenuItem as r, DropdownMenuTrigger as i, Sheet as a, SheetClose as o, SheetContent as s, SheetDescription as c, SheetHeader as l, SheetTitle as u, Skeleton as d, Spinner as f, Typography as p } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { ErrorState as m } from "../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
|
|
3
|
+
import "../../../shared/ui/dist/index.js";
|
|
4
|
+
import { PRODUCT_DETAILS_SHEET_LABELS_EN as h } from "./index2.js";
|
|
5
|
+
import { ProductTypeBadge as g } from "./index3.js";
|
|
6
|
+
import { ProductEditForm as _ } from "./index5.js";
|
|
7
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
8
|
+
import { MoreVertical as b, Trash2 as x, X as S } from "lucide-react";
|
|
9
|
+
import { twMerge as C } from "tailwind-merge";
|
|
4
10
|
//#region ../../libs/tesouro-embedded-components-react/products-widget/ui/dist/index6.js
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
variant: "
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
function w({ label: e, value: t, isLast: n, emptyValue: r = "—" }) {
|
|
12
|
+
return /* @__PURE__ */ y("li", {
|
|
13
|
+
className: C("ttw:flex ttw:gap-4 ttw:py-2.5", !n && "ttw:border-b ttw:border-border"),
|
|
14
|
+
children: [/* @__PURE__ */ v(p, {
|
|
15
|
+
variant: "body2",
|
|
16
|
+
color: "muted",
|
|
17
|
+
className: "ttw:w-35 ttw:min-w-35 ttw:font-medium",
|
|
18
|
+
children: e
|
|
19
|
+
}), typeof t == "string" ? /* @__PURE__ */ v(p, {
|
|
20
|
+
variant: "body2",
|
|
21
|
+
className: "ttw:min-w-0 ttw:font-medium ttw:wrap-break-word",
|
|
22
|
+
children: t || r
|
|
23
|
+
}) : t]
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function T({ open: C, onOpenChange: T, product: E, isLoading: D, isError: O, onEdit: k, onDelete: A, canEdit: j = !0, canDelete: M = !0, editForm: N, labels: P }) {
|
|
27
|
+
let F = {
|
|
28
|
+
...h,
|
|
29
|
+
...P,
|
|
30
|
+
typeBadge: {
|
|
31
|
+
...h.typeBadge,
|
|
32
|
+
...P?.typeBadge
|
|
33
|
+
}
|
|
34
|
+
}, I = E?.type !== "service", L = I ? F.typeBadge.product : F.typeBadge.service, R = E ? F.subtitle.replace("{type}", L).replace("{createdAt}", E.createdAtLabel) : F.hiddenDescription;
|
|
35
|
+
return /* @__PURE__ */ v(a, {
|
|
36
|
+
open: C,
|
|
37
|
+
onOpenChange: T,
|
|
38
|
+
children: /* @__PURE__ */ y(s, {
|
|
39
|
+
className: "ttw:w-150 ttw:sm:max-w-150 ttw:gap-0",
|
|
40
|
+
showCloseButton: !1,
|
|
41
|
+
children: [/* @__PURE__ */ y(l, {
|
|
42
|
+
className: "ttw:pt-6 ttw:pl-6 ttw:pr-4 ttw:pb-7 ttw:flex-row ttw:gap-3 ttw:border-b ttw:border-border",
|
|
43
|
+
children: [/* @__PURE__ */ y("div", {
|
|
44
|
+
className: "ttw:flex ttw:flex-col ttw:gap-1.5 ttw:flex-1 ttw:min-w-0",
|
|
45
|
+
children: [/* @__PURE__ */ v(u, {
|
|
46
|
+
className: "ttw:truncate ttw:text-2xl",
|
|
47
|
+
children: D ? /* @__PURE__ */ v(d, { className: "ttw:h-7 ttw:w-40" }) : E?.name ?? F.loadingTitle
|
|
48
|
+
}), /* @__PURE__ */ v(c, {
|
|
49
|
+
asChild: !0,
|
|
50
|
+
children: /* @__PURE__ */ v("div", { children: D ? /* @__PURE__ */ v(d, { className: "ttw:h-4 ttw:w-60" }) : R })
|
|
51
|
+
})]
|
|
52
|
+
}), /* @__PURE__ */ y("div", {
|
|
53
|
+
className: "ttw:flex ttw:gap-2 ttw:shrink-0",
|
|
54
|
+
children: [M && /* @__PURE__ */ y(t, { children: [/* @__PURE__ */ v(i, {
|
|
55
|
+
asChild: !0,
|
|
56
|
+
children: /* @__PURE__ */ v(e, {
|
|
57
|
+
type: "button",
|
|
58
|
+
variant: "outline",
|
|
59
|
+
disabled: !E,
|
|
60
|
+
"aria-label": F.moreActionsLabel,
|
|
61
|
+
className: "ttw:p-2 ttw:size-9 ttw:border-none ttw:bg-muted",
|
|
62
|
+
children: /* @__PURE__ */ v(b, { className: "ttw:size-4" })
|
|
63
|
+
})
|
|
64
|
+
}), /* @__PURE__ */ v(n, {
|
|
65
|
+
align: "end",
|
|
66
|
+
children: /* @__PURE__ */ y(r, {
|
|
67
|
+
onClick: A,
|
|
68
|
+
variant: "destructive",
|
|
69
|
+
children: [/* @__PURE__ */ v(x, { className: "ttw:size-4" }), F.deleteProductOption.replace("{type}", L)]
|
|
70
|
+
})
|
|
71
|
+
})] }), /* @__PURE__ */ v(o, {
|
|
72
|
+
"aria-label": F.closeLabel,
|
|
73
|
+
className: "ttw:size-9 ttw:bg-muted ttw:p-2 ttw:flex ttw:items-center ttw:justify-center ttw:rounded-md ttw:cursor-pointer",
|
|
74
|
+
children: /* @__PURE__ */ v(S, { className: "ttw:size-4" })
|
|
75
|
+
})]
|
|
76
|
+
})]
|
|
77
|
+
}), O ? /* @__PURE__ */ v(m, {
|
|
78
|
+
title: F.errorTitle,
|
|
79
|
+
description: F.errorDescription
|
|
80
|
+
}) : D || !E ? /* @__PURE__ */ v("div", {
|
|
81
|
+
className: "ttw:flex ttw:w-full ttw:h-full ttw:items-center ttw:justify-center",
|
|
82
|
+
children: /* @__PURE__ */ v(f, {})
|
|
83
|
+
}) : /* @__PURE__ */ v("main", {
|
|
84
|
+
className: "ttw:p-6 ttw:overflow-auto ttw:flex ttw:flex-col ttw:gap-4",
|
|
85
|
+
children: /* @__PURE__ */ y("div", {
|
|
86
|
+
className: "ttw:flex ttw:flex-col ttw:gap-4",
|
|
87
|
+
children: [/* @__PURE__ */ y("div", {
|
|
88
|
+
className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-3 ttw:pt-6 ttw:pb-7 ttw:border-b ttw:border-border",
|
|
89
|
+
children: [/* @__PURE__ */ y("div", {
|
|
90
|
+
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
91
|
+
children: [/* @__PURE__ */ v(p, {
|
|
92
|
+
variant: "body1",
|
|
93
|
+
className: "ttw:font-medium",
|
|
94
|
+
children: F.sectionHeading.replace("{type}", L)
|
|
95
|
+
}), /* @__PURE__ */ v(p, {
|
|
96
|
+
variant: "body2",
|
|
97
|
+
color: "muted",
|
|
98
|
+
children: I ? F.typeProductDescription : F.typeServiceDescription
|
|
99
|
+
})]
|
|
100
|
+
}), j && !N && /* @__PURE__ */ v(e, {
|
|
101
|
+
type: "button",
|
|
102
|
+
variant: "ghost",
|
|
103
|
+
className: "ttw:text-primary ttw:hover:text-primary",
|
|
104
|
+
onClick: k,
|
|
105
|
+
children: F.editButton
|
|
106
|
+
})]
|
|
107
|
+
}), N ? /* @__PURE__ */ v(_, { form: N }) : /* @__PURE__ */ y("ul", {
|
|
108
|
+
className: "ttw:list-none ttw:p-0 ttw:m-0",
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ v(w, {
|
|
111
|
+
label: F.rowName.replace("{type}", L),
|
|
112
|
+
value: E.name,
|
|
113
|
+
emptyValue: F.rowEmptyValue
|
|
114
|
+
}),
|
|
115
|
+
/* @__PURE__ */ v(w, {
|
|
116
|
+
label: F.rowPrice,
|
|
117
|
+
value: E.priceLabel,
|
|
118
|
+
emptyValue: F.rowEmptyValue
|
|
119
|
+
}),
|
|
120
|
+
/* @__PURE__ */ v(w, {
|
|
121
|
+
label: F.rowDescription,
|
|
122
|
+
value: E.description,
|
|
123
|
+
emptyValue: F.rowEmptyValue
|
|
124
|
+
}),
|
|
125
|
+
/* @__PURE__ */ v(w, {
|
|
126
|
+
label: F.rowType,
|
|
127
|
+
value: E.type ? /* @__PURE__ */ v(g, {
|
|
128
|
+
type: E.type,
|
|
129
|
+
labels: F.typeBadge
|
|
130
|
+
}) : F.rowEmptyValue
|
|
131
|
+
}),
|
|
132
|
+
/* @__PURE__ */ v(w, {
|
|
133
|
+
label: F.rowUnit,
|
|
134
|
+
value: E.unitLabel,
|
|
135
|
+
emptyValue: F.rowEmptyValue
|
|
136
|
+
}),
|
|
137
|
+
/* @__PURE__ */ v(w, {
|
|
138
|
+
label: F.rowCreatedOn,
|
|
139
|
+
value: E.createdAtLabel,
|
|
140
|
+
emptyValue: F.rowEmptyValue
|
|
141
|
+
}),
|
|
142
|
+
/* @__PURE__ */ v(w, {
|
|
143
|
+
label: F.rowLastUpdate,
|
|
144
|
+
value: E.updatedAtLabel,
|
|
145
|
+
emptyValue: F.rowEmptyValue,
|
|
146
|
+
isLast: !0
|
|
147
|
+
})
|
|
148
|
+
]
|
|
149
|
+
})]
|
|
150
|
+
})
|
|
151
|
+
})]
|
|
152
|
+
})
|
|
25
153
|
});
|
|
26
154
|
}
|
|
27
155
|
//#endregion
|
|
28
|
-
export {
|
|
156
|
+
export { T as ProductDetailsSheet, T as default };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AlertDialog as e, AlertDialogContent as t, AlertDialogDescription as n, AlertDialogFooter as r, AlertDialogHeader as i, AlertDialogTitle as a, Button as o } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { PRODUCT_DELETE_DIALOG_LABELS_EN as s } from "./index2.js";
|
|
3
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
4
|
+
//#region ../../libs/tesouro-embedded-components-react/products-widget/ui/dist/index7.js
|
|
5
|
+
function u({ open: u, onOpenChange: d, productName: f, isDeleting: p, onConfirm: m, onCancel: h, labels: g }) {
|
|
6
|
+
let _ = {
|
|
7
|
+
...s,
|
|
8
|
+
...g
|
|
9
|
+
};
|
|
10
|
+
return /* @__PURE__ */ c(e, {
|
|
11
|
+
open: u,
|
|
12
|
+
onOpenChange: d,
|
|
13
|
+
children: /* @__PURE__ */ l(t, { children: [/* @__PURE__ */ l(i, { children: [/* @__PURE__ */ c(a, { children: _.title.replace("{name}", f) }), /* @__PURE__ */ c(n, { children: _.message })] }), /* @__PURE__ */ l(r, { children: [/* @__PURE__ */ c(o, {
|
|
14
|
+
variant: "ghost",
|
|
15
|
+
onClick: h,
|
|
16
|
+
disabled: p,
|
|
17
|
+
children: _.cancelButton
|
|
18
|
+
}), /* @__PURE__ */ c(o, {
|
|
19
|
+
variant: "destructive",
|
|
20
|
+
onClick: m,
|
|
21
|
+
disabled: p,
|
|
22
|
+
loading: p,
|
|
23
|
+
children: _.confirmButton
|
|
24
|
+
})] })] })
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { u as ProductDeleteDialog, u as default };
|
|
@@ -16,10 +16,9 @@ var e = {
|
|
|
16
16
|
amountOverlap: "Overlaps another rule",
|
|
17
17
|
amountOverlapUnlisted: "Overlaps a rule that isn’t shown above",
|
|
18
18
|
approverGroupEmpty: "Choose at least one approver",
|
|
19
|
-
approverDuplicate: "This approver is already required by another
|
|
19
|
+
approverDuplicate: "This approver is already required by another step",
|
|
20
20
|
approverRolesLocked: "Remove the selected people to require a role instead.",
|
|
21
21
|
approverTeamMembersLocked: "Remove the selected role to require specific people instead.",
|
|
22
|
-
approverUsedByOtherRule: "Already required by another rule.",
|
|
23
22
|
approverUsedByOtherStep: "Already required by another step in this rule.",
|
|
24
23
|
unlistedPoliciesHeadingOne: "1 existing rule isn’t shown here",
|
|
25
24
|
unlistedPoliciesHeadingMany: "{count} existing rules aren’t shown here",
|
|
@@ -57,22 +57,21 @@ function m(e) {
|
|
|
57
57
|
upper: e.max === void 0 ? "" : r(e.max)
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
function h(e, { lookup: t, labels: n,
|
|
61
|
-
let
|
|
60
|
+
function h(e, { lookup: t, labels: n, usedByOtherSteps: r }) {
|
|
61
|
+
let i = !1, a = !1;
|
|
62
62
|
for (let n of e.selectedItems) {
|
|
63
63
|
let e = t.get(n.id)?.kind;
|
|
64
|
-
e === "role" ?
|
|
64
|
+
e === "role" ? i = !0 : e === "user" && (a = !0);
|
|
65
65
|
}
|
|
66
|
-
let
|
|
67
|
-
for (let e of r ?? [])
|
|
68
|
-
for (let e of i ?? []) s[e] ??= n.approverUsedByOtherStep;
|
|
66
|
+
let o = {};
|
|
67
|
+
for (let e of r ?? []) o[e] = n.approverUsedByOtherStep;
|
|
69
68
|
return {
|
|
70
69
|
...e,
|
|
71
70
|
lockedSections: {
|
|
72
|
-
roles:
|
|
73
|
-
teamMembers:
|
|
71
|
+
roles: a ? n.approverRolesLocked : void 0,
|
|
72
|
+
teamMembers: i ? n.approverTeamMembersLocked : void 0
|
|
74
73
|
},
|
|
75
|
-
lockedOptions:
|
|
74
|
+
lockedOptions: o
|
|
76
75
|
};
|
|
77
76
|
}
|
|
78
77
|
function g(e, t) {
|