@tesouro/embedded-components-react 0.7.72 → 0.7.73
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/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,8 +1,9 @@
|
|
|
1
|
+
import { FILTER_MENU_BUTTON_LABELS_EN as e, FILTER_TAG_LABELS_EN as t } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
1
2
|
//#region ../../libs/tesouro-embedded-components-react/products-widget/ui/dist/index2.js
|
|
2
|
-
var
|
|
3
|
+
var n = {
|
|
3
4
|
product: "Product",
|
|
4
5
|
service: "Service"
|
|
5
|
-
},
|
|
6
|
+
}, r = {
|
|
6
7
|
createButton: "Add product or service",
|
|
7
8
|
manageUnitsButton: "Manage units of measure",
|
|
8
9
|
columnName: "Name",
|
|
@@ -11,7 +12,15 @@ var e = {
|
|
|
11
12
|
columnUnit: "Unit",
|
|
12
13
|
columnPrice: "Price per unit",
|
|
13
14
|
searchPlaceholder: "Search by name",
|
|
14
|
-
|
|
15
|
+
searchLabel: "Search by name",
|
|
16
|
+
filtersButton: e.filters,
|
|
17
|
+
filterFieldType: "Type",
|
|
18
|
+
filterFieldUnit: "Unit",
|
|
19
|
+
filterChipRemove: t.remove,
|
|
20
|
+
typeChip: (e) => `Type: ${e}`,
|
|
21
|
+
unitChip: (e) => `Unit: ${e}`,
|
|
22
|
+
searchChip: (e) => `Search: ${e}`,
|
|
23
|
+
clearAllFilters: "Clear all",
|
|
15
24
|
typeFilterProduct: "Products",
|
|
16
25
|
typeFilterService: "Services",
|
|
17
26
|
unitFilterAll: "All units",
|
|
@@ -30,7 +39,7 @@ var e = {
|
|
|
30
39
|
product: "Product",
|
|
31
40
|
service: "Service"
|
|
32
41
|
}
|
|
33
|
-
},
|
|
42
|
+
}, i = {
|
|
34
43
|
hiddenDescription: "Product details",
|
|
35
44
|
subtitle: "{type} · Added {createdAt}",
|
|
36
45
|
sectionHeading: "{type} details",
|
|
@@ -56,11 +65,11 @@ var e = {
|
|
|
56
65
|
product: "Product",
|
|
57
66
|
service: "Service"
|
|
58
67
|
}
|
|
59
|
-
},
|
|
68
|
+
}, a = {
|
|
60
69
|
title: "Delete \"{name}\"?",
|
|
61
70
|
message: "It will remain in all the documents where it is added. You can't undo this action.",
|
|
62
71
|
confirmButton: "Delete",
|
|
63
72
|
cancelButton: "Cancel"
|
|
64
73
|
};
|
|
65
74
|
//#endregion
|
|
66
|
-
export {
|
|
75
|
+
export { r as PRODUCTS_SCREEN_LABELS_EN, a as PRODUCT_DELETE_DIALOG_LABELS_EN, i as PRODUCT_DETAILS_SHEET_LABELS_EN, n as PRODUCT_TYPE_BADGE_LABELS_EN };
|
|
@@ -1,157 +1,199 @@
|
|
|
1
|
-
import { Button as e, DataTable as t,
|
|
2
|
-
import { EmptyState as
|
|
3
|
-
import { ErrorState as
|
|
1
|
+
import { Button as e, DataTable as t, FilterBar as n, FilterMenuButton as r, FilterTag as i, MultiSelectFilter as a, Popover as o, PopoverContent as s, PopoverTrigger as c, RadioGroup as l, RadioGroupItem as u, SearchInput as d } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { EmptyState as f } from "../../../shared/ui/dist/lib/EmptyState/EmptyState.js";
|
|
3
|
+
import { ErrorState as p } from "../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
|
|
4
4
|
import "../../../shared/ui/dist/index.js";
|
|
5
|
-
import { PRODUCTS_SCREEN_LABELS_EN as
|
|
6
|
-
import { ProductTypeBadge as
|
|
7
|
-
import { Fragment as
|
|
8
|
-
import { ArrowDownIcon as
|
|
5
|
+
import { PRODUCTS_SCREEN_LABELS_EN as m } from "./index2.js";
|
|
6
|
+
import { ProductTypeBadge as h } from "./index3.js";
|
|
7
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
8
|
+
import { ArrowDownIcon as y, ArrowUpDownIcon as b, ArrowUpIcon as x, ListFilter as S } from "lucide-react";
|
|
9
9
|
//#region ../../libs/tesouro-embedded-components-react/products-widget/ui/dist/index4.js
|
|
10
|
-
var
|
|
10
|
+
var C = [
|
|
11
11
|
10,
|
|
12
12
|
25,
|
|
13
13
|
50,
|
|
14
14
|
100
|
|
15
|
-
],
|
|
16
|
-
function
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
className: "ttw:flex
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
15
|
+
], w = "ttw:flex ttw:w-full ttw:cursor-pointer ttw:items-center ttw:gap-2 ttw:rounded-md ttw:px-2 ttw:py-1.5 ttw:text-xs ttw:font-medium ttw:transition-colors ttw:hover:bg-accent";
|
|
16
|
+
function T({ labels: e, filters: t }) {
|
|
17
|
+
return /* @__PURE__ */ _(n, {
|
|
18
|
+
className: "ttw:flex-wrap ttw:px-4",
|
|
19
|
+
searchSlot: /* @__PURE__ */ _(d, {
|
|
20
|
+
value: t.searchValue,
|
|
21
|
+
onChange: (e) => t.onSearchChange(e.target.value),
|
|
22
|
+
placeholder: e.searchPlaceholder,
|
|
23
|
+
"aria-label": e.searchLabel,
|
|
24
|
+
className: "ttw:min-w-64"
|
|
25
|
+
}),
|
|
26
|
+
menuSlot: /* @__PURE__ */ v(o, {
|
|
27
|
+
open: t.isPopoverOpen,
|
|
28
|
+
onOpenChange: (e) => {
|
|
29
|
+
e || t.onPopoverClose();
|
|
30
|
+
},
|
|
31
|
+
children: [/* @__PURE__ */ _(c, {
|
|
32
|
+
asChild: !0,
|
|
33
|
+
children: /* @__PURE__ */ _(r, {
|
|
34
|
+
activeCount: t.activeFilterCount,
|
|
35
|
+
onClick: (e) => {
|
|
36
|
+
t.isPanelOpen && e.preventDefault(), t.onMenuToggle();
|
|
37
|
+
},
|
|
38
|
+
labels: { filters: e.filtersButton }
|
|
39
|
+
})
|
|
40
|
+
}), /* @__PURE__ */ v(s, {
|
|
41
|
+
align: "start",
|
|
42
|
+
className: "ttw:w-56 ttw:p-0",
|
|
43
|
+
children: [
|
|
44
|
+
t.isMenuOpen && /* @__PURE__ */ v("div", {
|
|
45
|
+
className: "ttw:p-1",
|
|
46
|
+
children: [/* @__PURE__ */ v("button", {
|
|
47
|
+
type: "button",
|
|
48
|
+
className: w,
|
|
49
|
+
onClick: t.onTypeFieldSelect,
|
|
50
|
+
children: [/* @__PURE__ */ _(S, {
|
|
51
|
+
className: "ttw:size-4 ttw:shrink-0 ttw:text-muted-foreground",
|
|
52
|
+
"aria-hidden": !0
|
|
53
|
+
}), e.filterFieldType]
|
|
54
|
+
}), /* @__PURE__ */ v("button", {
|
|
55
|
+
type: "button",
|
|
56
|
+
className: w,
|
|
57
|
+
onClick: t.onUnitFieldSelect,
|
|
58
|
+
children: [/* @__PURE__ */ _(S, {
|
|
59
|
+
className: "ttw:size-4 ttw:shrink-0 ttw:text-muted-foreground",
|
|
60
|
+
"aria-hidden": !0
|
|
61
|
+
}), e.filterFieldUnit]
|
|
62
|
+
})]
|
|
42
63
|
}),
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
|
|
45
|
-
|
|
64
|
+
t.isTypePanelOpen && /* @__PURE__ */ _(a, {
|
|
65
|
+
options: [...t.typeOptions],
|
|
66
|
+
selectedValues: [...t.selectedTypes],
|
|
67
|
+
onSelectionChange: t.onTypeChange
|
|
46
68
|
}),
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
|
|
49
|
-
children:
|
|
69
|
+
t.isUnitPanelOpen && /* @__PURE__ */ _("div", {
|
|
70
|
+
className: "ttw:max-h-64 ttw:overflow-auto ttw:p-3",
|
|
71
|
+
children: /* @__PURE__ */ _(l, {
|
|
72
|
+
value: t.selectedUnit,
|
|
73
|
+
onValueChange: t.onUnitChange,
|
|
74
|
+
"aria-label": e.filterFieldUnit,
|
|
75
|
+
className: "ttw:flex ttw:flex-col ttw:gap-1",
|
|
76
|
+
children: t.unitOptions.map((e) => /* @__PURE__ */ v("label", {
|
|
77
|
+
className: "ttw:flex ttw:cursor-pointer ttw:items-center ttw:gap-2",
|
|
78
|
+
children: [/* @__PURE__ */ _(u, { value: e.value }), /* @__PURE__ */ _("span", {
|
|
79
|
+
className: "ttw:text-xs ttw:font-medium",
|
|
80
|
+
children: e.label
|
|
81
|
+
})]
|
|
82
|
+
}, e.value))
|
|
83
|
+
})
|
|
50
84
|
})
|
|
51
|
-
]
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
value: e.value,
|
|
66
|
-
children: e.label
|
|
67
|
-
}, e.value))] })]
|
|
68
|
-
}), v]
|
|
69
|
-
})
|
|
70
|
-
]
|
|
85
|
+
]
|
|
86
|
+
})]
|
|
87
|
+
}),
|
|
88
|
+
activeChipsSlot: /* @__PURE__ */ v(g, { children: [t.chips.map((n) => /* @__PURE__ */ _(i, {
|
|
89
|
+
label: n.label,
|
|
90
|
+
variant: "default",
|
|
91
|
+
labels: { remove: e.filterChipRemove },
|
|
92
|
+
onDismiss: () => t.onRemoveChip(n.key)
|
|
93
|
+
}, n.key)), t.chips.length > 0 && /* @__PURE__ */ _("button", {
|
|
94
|
+
type: "button",
|
|
95
|
+
className: "ttw:cursor-pointer ttw:whitespace-nowrap ttw:text-xs ttw:text-muted-foreground ttw:transition-colors ttw:hover:text-foreground",
|
|
96
|
+
onClick: t.onClearAll,
|
|
97
|
+
children: e.clearAllFilters
|
|
98
|
+
})] })
|
|
71
99
|
});
|
|
72
100
|
}
|
|
73
|
-
function
|
|
74
|
-
let
|
|
75
|
-
...
|
|
76
|
-
...
|
|
101
|
+
function E({ products: n, isLoading: r, isError: i, sorting: a, onSortingChange: o, pageSize: s, onPageSizeChange: c, pageSizeOptions: l = C, hasNextPage: u, hasPrevPage: d, onNextPage: S, onPrevPage: w, filters: E, isFiltering: D, onCreateClick: O, onManageUnitsClick: k, onRowClick: A, onRetry: j, canCreate: M = !0, canManageUnits: N = !0, isAccessRestricted: P, labels: F, testIds: I }) {
|
|
102
|
+
let L = {
|
|
103
|
+
...m,
|
|
104
|
+
...F,
|
|
77
105
|
typeBadge: {
|
|
78
|
-
...
|
|
79
|
-
...
|
|
106
|
+
...m.typeBadge,
|
|
107
|
+
...F?.typeBadge
|
|
80
108
|
}
|
|
81
|
-
},
|
|
109
|
+
}, R = [
|
|
82
110
|
{
|
|
83
111
|
accessorKey: "name",
|
|
84
112
|
enableSorting: !0,
|
|
85
113
|
header: ({ column: t }) => {
|
|
86
114
|
let n = t.getIsSorted();
|
|
87
|
-
return /* @__PURE__ */
|
|
115
|
+
return /* @__PURE__ */ v("div", {
|
|
88
116
|
className: "ttw:flex ttw:items-center ttw:gap-2 ttw:text-inherit",
|
|
89
|
-
children: [
|
|
117
|
+
children: [L.columnName, /* @__PURE__ */ _(e, {
|
|
90
118
|
variant: "ghost",
|
|
91
119
|
size: "icon-sm",
|
|
92
120
|
onClick: () => t.toggleSorting(n === "asc"),
|
|
93
|
-
children:
|
|
121
|
+
children: _(n === "asc" ? x : n === "desc" ? y : b, { className: "ttw:size-4" })
|
|
94
122
|
})]
|
|
95
123
|
});
|
|
96
|
-
}
|
|
124
|
+
},
|
|
125
|
+
size: 320,
|
|
126
|
+
cell: ({ row: e }) => /* @__PURE__ */ _("span", {
|
|
127
|
+
className: "ttw:block ttw:w-74 ttw:truncate",
|
|
128
|
+
children: e.original.name
|
|
129
|
+
})
|
|
97
130
|
},
|
|
98
131
|
{
|
|
99
132
|
accessorKey: "type",
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
133
|
+
size: 112,
|
|
134
|
+
header: L.columnType,
|
|
135
|
+
cell: ({ row: e }) => /* @__PURE__ */ _("div", {
|
|
136
|
+
className: "ttw:w-22",
|
|
137
|
+
children: e.original.type && /* @__PURE__ */ _(h, {
|
|
138
|
+
type: e.original.type,
|
|
139
|
+
labels: L.typeBadge
|
|
140
|
+
})
|
|
141
|
+
})
|
|
105
142
|
},
|
|
106
143
|
{
|
|
107
144
|
accessorKey: "description",
|
|
108
|
-
header:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
145
|
+
header: L.columnDescription,
|
|
146
|
+
size: 1e4,
|
|
147
|
+
cell: ({ row: e }) => /* @__PURE__ */ _("div", {
|
|
148
|
+
className: "ttw:relative ttw:h-5 ttw:min-w-40",
|
|
149
|
+
children: /* @__PURE__ */ _("span", {
|
|
150
|
+
className: "ttw:absolute ttw:inset-0 ttw:truncate",
|
|
113
151
|
children: e.original.description
|
|
114
152
|
})
|
|
115
153
|
})
|
|
116
154
|
},
|
|
117
155
|
{
|
|
118
156
|
accessorKey: "priceLabel",
|
|
119
|
-
|
|
157
|
+
size: 180,
|
|
158
|
+
header: () => /* @__PURE__ */ _("div", {
|
|
120
159
|
className: "ttw:text-right",
|
|
121
|
-
children:
|
|
160
|
+
children: L.columnPrice
|
|
122
161
|
}),
|
|
123
|
-
cell: ({ row: e }) => /* @__PURE__ */
|
|
124
|
-
className: "ttw:flex ttw:justify-end ttw:items-center ttw:gap-1",
|
|
125
|
-
children: [/* @__PURE__ */
|
|
126
|
-
className: "ttw:text-muted-foreground ttw:text-
|
|
162
|
+
cell: ({ row: e }) => /* @__PURE__ */ v("div", {
|
|
163
|
+
className: "ttw:flex ttw:w-39 ttw:justify-end ttw:items-center ttw:gap-1",
|
|
164
|
+
children: [/* @__PURE__ */ _("span", { children: e.original.priceLabel }), e.original.unitLabel && /* @__PURE__ */ _("span", {
|
|
165
|
+
className: "ttw:text-muted-foreground ttw:text-sm",
|
|
127
166
|
children: e.original.unitLabel
|
|
128
167
|
})]
|
|
129
168
|
})
|
|
130
169
|
}
|
|
131
|
-
]
|
|
132
|
-
|
|
133
|
-
className: "ttw:text-primary ttw:hover:text-primary",
|
|
134
|
-
onClick: I,
|
|
135
|
-
disabled: !B,
|
|
136
|
-
children: W.manageUnitsButton
|
|
137
|
-
}), /* @__PURE__ */ g(e, {
|
|
138
|
-
onClick: F,
|
|
139
|
-
disabled: !z,
|
|
140
|
-
children: [/* @__PURE__ */ h(b, { className: "ttw:size-4" }), W.createButton]
|
|
141
|
-
})] });
|
|
142
|
-
return /* @__PURE__ */ h("div", {
|
|
170
|
+
];
|
|
171
|
+
return /* @__PURE__ */ _("div", {
|
|
143
172
|
className: "ttw:flex ttw:flex-col ttw:gap-4",
|
|
144
|
-
children:
|
|
145
|
-
testId:
|
|
146
|
-
title:
|
|
147
|
-
description:
|
|
148
|
-
}) : i ? /* @__PURE__ */
|
|
149
|
-
title:
|
|
150
|
-
description:
|
|
151
|
-
retryLabel:
|
|
152
|
-
onRetry:
|
|
153
|
-
}) : /* @__PURE__ */
|
|
154
|
-
|
|
173
|
+
children: P ? /* @__PURE__ */ _(p, {
|
|
174
|
+
testId: I?.accessRestricted,
|
|
175
|
+
title: L.accessRestrictedTitle,
|
|
176
|
+
description: L.accessRestrictedDescription
|
|
177
|
+
}) : i ? /* @__PURE__ */ _(p, {
|
|
178
|
+
title: L.errorTitle,
|
|
179
|
+
description: L.errorDescription,
|
|
180
|
+
retryLabel: j ? L.errorRetry : void 0,
|
|
181
|
+
onRetry: j
|
|
182
|
+
}) : /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ v("div", {
|
|
183
|
+
className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:justify-end ttw:gap-2",
|
|
184
|
+
children: [/* @__PURE__ */ _(e, {
|
|
185
|
+
variant: "ghost",
|
|
186
|
+
className: "ttw:text-primary ttw:hover:text-primary",
|
|
187
|
+
onClick: k,
|
|
188
|
+
disabled: !N,
|
|
189
|
+
children: L.manageUnitsButton
|
|
190
|
+
}), /* @__PURE__ */ _(e, {
|
|
191
|
+
onClick: O,
|
|
192
|
+
disabled: !M,
|
|
193
|
+
children: L.createButton
|
|
194
|
+
})]
|
|
195
|
+
}), /* @__PURE__ */ _(t, {
|
|
196
|
+
columns: R,
|
|
155
197
|
data: n,
|
|
156
198
|
isLoading: r,
|
|
157
199
|
sorting: a,
|
|
@@ -159,32 +201,25 @@ function T({ products: n, isLoading: r, isError: i, sorting: a, onSortingChange:
|
|
|
159
201
|
pageSize: s,
|
|
160
202
|
onPageSizeChange: c,
|
|
161
203
|
pageSizeOptions: l,
|
|
162
|
-
hasNextPage:
|
|
163
|
-
hasPrevPage:
|
|
164
|
-
onNextPage:
|
|
165
|
-
onPrevPage:
|
|
166
|
-
onRowClick:
|
|
167
|
-
rowAriaLabel: (e) =>
|
|
168
|
-
filterComponent: /* @__PURE__ */
|
|
169
|
-
labels:
|
|
170
|
-
|
|
171
|
-
onSearchChange: O,
|
|
172
|
-
typeFilter: k,
|
|
173
|
-
onTypeFilterChange: A,
|
|
174
|
-
unitFilter: j,
|
|
175
|
-
onUnitFilterChange: M,
|
|
176
|
-
unitOptions: N,
|
|
177
|
-
headerActions: K
|
|
204
|
+
hasNextPage: u,
|
|
205
|
+
hasPrevPage: d,
|
|
206
|
+
onNextPage: S,
|
|
207
|
+
onPrevPage: w,
|
|
208
|
+
onRowClick: A,
|
|
209
|
+
rowAriaLabel: (e) => L.openRow(e.name),
|
|
210
|
+
filterComponent: /* @__PURE__ */ _(T, {
|
|
211
|
+
labels: L,
|
|
212
|
+
filters: E
|
|
178
213
|
}),
|
|
179
|
-
children: /* @__PURE__ */
|
|
180
|
-
testId:
|
|
181
|
-
title:
|
|
182
|
-
description:
|
|
183
|
-
actionLabel:
|
|
184
|
-
onAction:
|
|
214
|
+
children: /* @__PURE__ */ _(f, {
|
|
215
|
+
testId: I?.empty,
|
|
216
|
+
title: D ? L.filterEmptyTitle : L.emptyTitle,
|
|
217
|
+
description: D ? L.filterEmptyDescription : L.emptyDescription,
|
|
218
|
+
actionLabel: D || !M ? void 0 : L.emptyAction,
|
|
219
|
+
onAction: D || !M ? void 0 : O
|
|
185
220
|
})
|
|
186
|
-
})
|
|
221
|
+
})] })
|
|
187
222
|
});
|
|
188
223
|
}
|
|
189
224
|
//#endregion
|
|
190
|
-
export {
|
|
225
|
+
export { E as ProductsScreen, E as default };
|
|
@@ -1,155 +1,54 @@
|
|
|
1
|
-
import { Button as e,
|
|
2
|
-
import {
|
|
3
|
-
import "../../../shared/ui/dist/
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import { jsx as
|
|
7
|
-
import { MoreVertical as y, Trash2 as b, X as x } from "lucide-react";
|
|
8
|
-
import { twMerge as S } from "tailwind-merge";
|
|
1
|
+
import { Button as e, Typography as t } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { mergeProductFormSheetLabels as n } from "../../../shared/product-catalog/ui/dist/index2.js";
|
|
3
|
+
import { ProductFormFields as r } from "../../../shared/product-catalog/ui/dist/index3.js";
|
|
4
|
+
import "../../../shared/product-catalog/ui/dist/index.js";
|
|
5
|
+
import { useId as i } from "react";
|
|
6
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
9
7
|
//#region ../../libs/tesouro-embedded-components-react/products-widget/ui/dist/index5.js
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
function w({ open: S, onOpenChange: w, product: T, isLoading: E, isError: D, onEdit: O, onDelete: k, canEdit: A = !0, canDelete: j = !0, labels: M }) {
|
|
26
|
-
let N = {
|
|
27
|
-
...h,
|
|
28
|
-
...M,
|
|
29
|
-
typeBadge: {
|
|
30
|
-
...h.typeBadge,
|
|
31
|
-
...M?.typeBadge
|
|
32
|
-
}
|
|
33
|
-
}, P = T?.type !== "service", F = P ? N.typeBadge.product : N.typeBadge.service, I = T ? N.subtitle.replace("{type}", F).replace("{createdAt}", T.createdAtLabel) : N.hiddenDescription;
|
|
34
|
-
return /* @__PURE__ */ _(a, {
|
|
35
|
-
open: S,
|
|
36
|
-
onOpenChange: w,
|
|
37
|
-
children: /* @__PURE__ */ v(s, {
|
|
38
|
-
className: "ttw:w-150 ttw:sm:max-w-150 ttw:gap-0",
|
|
39
|
-
showCloseButton: !1,
|
|
40
|
-
children: [/* @__PURE__ */ v(l, {
|
|
41
|
-
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",
|
|
42
|
-
children: [/* @__PURE__ */ v("div", {
|
|
43
|
-
className: "ttw:flex ttw:flex-col ttw:gap-1.5 ttw:flex-1 ttw:min-w-0",
|
|
44
|
-
children: [/* @__PURE__ */ _(u, {
|
|
45
|
-
className: "ttw:text-2xl",
|
|
46
|
-
children: E ? /* @__PURE__ */ _(d, { className: "ttw:h-7 ttw:w-40" }) : T?.name ?? N.loadingTitle
|
|
47
|
-
}), /* @__PURE__ */ _(c, {
|
|
48
|
-
asChild: !0,
|
|
49
|
-
children: /* @__PURE__ */ _("div", { children: E ? /* @__PURE__ */ _(d, { className: "ttw:h-4 ttw:w-60" }) : I })
|
|
50
|
-
})]
|
|
51
|
-
}), /* @__PURE__ */ v("div", {
|
|
52
|
-
className: "ttw:flex ttw:gap-2 ttw:shrink-0",
|
|
53
|
-
children: [j && /* @__PURE__ */ v(t, { children: [/* @__PURE__ */ _(i, {
|
|
54
|
-
asChild: !0,
|
|
55
|
-
children: /* @__PURE__ */ _(e, {
|
|
56
|
-
type: "button",
|
|
57
|
-
variant: "outline",
|
|
58
|
-
disabled: !T,
|
|
59
|
-
"aria-label": N.moreActionsLabel,
|
|
60
|
-
className: "ttw:p-2 ttw:size-9 ttw:border-none ttw:bg-muted",
|
|
61
|
-
children: /* @__PURE__ */ _(y, { className: "ttw:size-4" })
|
|
62
|
-
})
|
|
63
|
-
}), /* @__PURE__ */ _(n, {
|
|
64
|
-
align: "end",
|
|
65
|
-
children: /* @__PURE__ */ v(r, {
|
|
66
|
-
onClick: k,
|
|
67
|
-
variant: "destructive",
|
|
68
|
-
children: [/* @__PURE__ */ _(b, { className: "ttw:size-4" }), N.deleteProductOption.replace("{type}", F)]
|
|
69
|
-
})
|
|
70
|
-
})] }), /* @__PURE__ */ _(o, {
|
|
71
|
-
"aria-label": N.closeLabel,
|
|
72
|
-
className: "ttw:size-9 ttw:bg-muted ttw:p-2 ttw:flex ttw:items-center ttw:justify-center ttw:rounded-md ttw:cursor-pointer",
|
|
73
|
-
children: /* @__PURE__ */ _(x, { className: "ttw:size-4" })
|
|
74
|
-
})]
|
|
75
|
-
})]
|
|
76
|
-
}), D ? /* @__PURE__ */ _(m, {
|
|
77
|
-
title: N.errorTitle,
|
|
78
|
-
description: N.errorDescription
|
|
79
|
-
}) : E || !T ? /* @__PURE__ */ _("div", {
|
|
80
|
-
className: "ttw:flex ttw:w-full ttw:h-full ttw:items-center ttw:justify-center",
|
|
81
|
-
children: /* @__PURE__ */ _(f, {})
|
|
82
|
-
}) : /* @__PURE__ */ _("main", {
|
|
83
|
-
className: "ttw:p-6 ttw:overflow-auto ttw:flex ttw:flex-col ttw:gap-4",
|
|
84
|
-
children: /* @__PURE__ */ v("div", {
|
|
85
|
-
className: "ttw:flex ttw:flex-col ttw:gap-4",
|
|
86
|
-
children: [/* @__PURE__ */ v("div", {
|
|
87
|
-
className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-3 ttw:pt-6 ttw:pb-7 ttw:border-b ttw:border-border",
|
|
88
|
-
children: [/* @__PURE__ */ v("div", {
|
|
89
|
-
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
90
|
-
children: [/* @__PURE__ */ _(p, {
|
|
91
|
-
variant: "body1",
|
|
92
|
-
className: "ttw:font-medium",
|
|
93
|
-
children: N.sectionHeading.replace("{type}", F)
|
|
94
|
-
}), /* @__PURE__ */ _(p, {
|
|
95
|
-
variant: "body2",
|
|
96
|
-
color: "muted",
|
|
97
|
-
children: P ? N.typeProductDescription : N.typeServiceDescription
|
|
98
|
-
})]
|
|
99
|
-
}), A && /* @__PURE__ */ _(e, {
|
|
100
|
-
type: "button",
|
|
101
|
-
variant: "ghost",
|
|
102
|
-
className: "ttw:text-primary ttw:hover:text-primary",
|
|
103
|
-
onClick: O,
|
|
104
|
-
children: N.editButton
|
|
105
|
-
})]
|
|
106
|
-
}), /* @__PURE__ */ v("ul", {
|
|
107
|
-
className: "ttw:list-none ttw:p-0 ttw:m-0",
|
|
108
|
-
children: [
|
|
109
|
-
/* @__PURE__ */ _(C, {
|
|
110
|
-
label: N.rowName.replace("{type}", F),
|
|
111
|
-
value: T.name,
|
|
112
|
-
emptyValue: N.rowEmptyValue
|
|
113
|
-
}),
|
|
114
|
-
/* @__PURE__ */ _(C, {
|
|
115
|
-
label: N.rowPrice,
|
|
116
|
-
value: T.priceLabel,
|
|
117
|
-
emptyValue: N.rowEmptyValue
|
|
118
|
-
}),
|
|
119
|
-
/* @__PURE__ */ _(C, {
|
|
120
|
-
label: N.rowDescription,
|
|
121
|
-
value: T.description,
|
|
122
|
-
emptyValue: N.rowEmptyValue
|
|
123
|
-
}),
|
|
124
|
-
/* @__PURE__ */ _(C, {
|
|
125
|
-
label: N.rowType,
|
|
126
|
-
value: T.type ? /* @__PURE__ */ _(g, {
|
|
127
|
-
type: T.type,
|
|
128
|
-
labels: N.typeBadge
|
|
129
|
-
}) : N.rowEmptyValue
|
|
130
|
-
}),
|
|
131
|
-
/* @__PURE__ */ _(C, {
|
|
132
|
-
label: N.rowUnit,
|
|
133
|
-
value: T.unitLabel,
|
|
134
|
-
emptyValue: N.rowEmptyValue
|
|
135
|
-
}),
|
|
136
|
-
/* @__PURE__ */ _(C, {
|
|
137
|
-
label: N.rowCreatedOn,
|
|
138
|
-
value: T.createdAtLabel,
|
|
139
|
-
emptyValue: N.rowEmptyValue
|
|
140
|
-
}),
|
|
141
|
-
/* @__PURE__ */ _(C, {
|
|
142
|
-
label: N.rowLastUpdate,
|
|
143
|
-
value: T.updatedAtLabel,
|
|
144
|
-
emptyValue: N.rowEmptyValue,
|
|
145
|
-
isLast: !0
|
|
146
|
-
})
|
|
147
|
-
]
|
|
148
|
-
})]
|
|
8
|
+
function s({ form: s }) {
|
|
9
|
+
let c = n(s.labels), l = i();
|
|
10
|
+
return /* @__PURE__ */ o("form", {
|
|
11
|
+
className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:rounded-[10px] ttw:border ttw:border-border ttw:bg-muted ttw:p-4",
|
|
12
|
+
onSubmit: (e) => {
|
|
13
|
+
e.preventDefault(), e.stopPropagation(), s.onSubmit();
|
|
14
|
+
},
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ a("div", {
|
|
17
|
+
className: "ttw:flex ttw:flex-col ttw:gap-1.5 ttw:border-b ttw:border-border ttw:pt-6 ttw:pb-7",
|
|
18
|
+
children: /* @__PURE__ */ a(t, {
|
|
19
|
+
variant: "body1",
|
|
20
|
+
className: "ttw:font-medium",
|
|
21
|
+
children: s.heading
|
|
149
22
|
})
|
|
150
|
-
})
|
|
151
|
-
|
|
23
|
+
}),
|
|
24
|
+
/* @__PURE__ */ a(r, {
|
|
25
|
+
idPrefix: l,
|
|
26
|
+
values: s.values,
|
|
27
|
+
errors: s.errors,
|
|
28
|
+
unitOptions: s.unitOptions,
|
|
29
|
+
pricePrefix: s.pricePrefix,
|
|
30
|
+
onChange: s.onChange,
|
|
31
|
+
labels: s.labels
|
|
32
|
+
}),
|
|
33
|
+
/* @__PURE__ */ o("div", {
|
|
34
|
+
className: "ttw:flex ttw:justify-end ttw:gap-4 ttw:pt-6",
|
|
35
|
+
children: [/* @__PURE__ */ a(e, {
|
|
36
|
+
type: "button",
|
|
37
|
+
variant: "outline",
|
|
38
|
+
className: "ttw:w-fit ttw:border-border",
|
|
39
|
+
disabled: s.inProgress,
|
|
40
|
+
onClick: s.onCancel,
|
|
41
|
+
children: c.cancelButton
|
|
42
|
+
}), /* @__PURE__ */ a(e, {
|
|
43
|
+
type: "submit",
|
|
44
|
+
className: "ttw:w-fit",
|
|
45
|
+
disabled: s.inProgress || s.submitDisabled,
|
|
46
|
+
loading: s.inProgress,
|
|
47
|
+
children: c.saveButton
|
|
48
|
+
})]
|
|
49
|
+
})
|
|
50
|
+
]
|
|
152
51
|
});
|
|
153
52
|
}
|
|
154
53
|
//#endregion
|
|
155
|
-
export {
|
|
54
|
+
export { s as ProductEditForm, s as default };
|