@tesouro/embedded-components-react 0.5.194 → 0.5.195
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 -2
- package/dist/index.css +3 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +12 -3
- package/dist/lib/ReceivablesWidget.js +1 -1
- 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 +245 -65
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js +66 -106
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +102 -223
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +225 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js +182 -371
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index6.js +401 -60
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index7.js +62 -193
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js +184 -31
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +31 -149
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +292 -161
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index2.js +11 -3
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index4.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index5.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index15.js +4 -1
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +36 -36
- 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/data-access/dist/index.js +12 -11
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index10.js +16 -23
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index11.js +7 -8
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index12.js +17 -18
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index13.js +36 -0
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index3.js +43 -16
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index4.js +23 -13
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index5.js +13 -30
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index6.js +18 -23
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index7.js +22 -16
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index8.js +22 -15
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index9.js +10 -11
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/index.js +10 -9
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/ProductSelector.js +9 -13
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useMeasureUnits.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useProductForm.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useProductSelector.js +28 -41
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index2.js +7 -15
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index6.js +100 -69
- package/package.json +1 -1
|
@@ -2,32 +2,38 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
5
|
+
import { patchProductsId as e } from "../../../data-access/dist/lib/rest/sdk.gen.js";
|
|
6
6
|
import { invalidateAllClients as t } from "../../../data-access/dist/lib/clientRegistry.js";
|
|
7
7
|
import { useEmbedApi as n } from "../../../data-access/dist/lib/EmbedApiContext.js";
|
|
8
8
|
import { organizationHeaders as r } from "../../../data-access/dist/lib/organizationHeaders.js";
|
|
9
9
|
import "../../../data-access/dist/index.js";
|
|
10
|
-
import {
|
|
11
|
-
import { useMutation as
|
|
10
|
+
import { productInvalidationKey as i, productsInvalidationKey as a } from "./index5.js";
|
|
11
|
+
import { useMutation as o } from "@tanstack/react-query";
|
|
12
12
|
//#region ../../libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index7.js
|
|
13
|
-
function
|
|
14
|
-
let { client:
|
|
15
|
-
return
|
|
16
|
-
mutationFn: async ({ path: t }) => {
|
|
17
|
-
await e({
|
|
18
|
-
client:
|
|
19
|
-
headers: r(
|
|
13
|
+
function s() {
|
|
14
|
+
let { client: s, organizationId: c } = n();
|
|
15
|
+
return o({
|
|
16
|
+
mutationFn: async ({ path: t, body: n }) => {
|
|
17
|
+
let { data: i } = await e({
|
|
18
|
+
client: s,
|
|
19
|
+
headers: r(c),
|
|
20
20
|
path: t,
|
|
21
|
+
body: n,
|
|
21
22
|
throwOnError: !0
|
|
22
23
|
});
|
|
24
|
+
return i;
|
|
23
25
|
},
|
|
24
|
-
onSuccess: async () => {
|
|
25
|
-
await t(
|
|
26
|
-
client:
|
|
27
|
-
organizationId:
|
|
28
|
-
}))
|
|
26
|
+
onSuccess: async (e, n) => {
|
|
27
|
+
await Promise.all([t(a({
|
|
28
|
+
client: s,
|
|
29
|
+
organizationId: c
|
|
30
|
+
})), t(i({
|
|
31
|
+
client: s,
|
|
32
|
+
organizationId: c,
|
|
33
|
+
productId: n.path.product_id
|
|
34
|
+
}))]);
|
|
29
35
|
}
|
|
30
36
|
});
|
|
31
37
|
}
|
|
32
38
|
//#endregion
|
|
33
|
-
export {
|
|
39
|
+
export { s as useUpdateProductMutation };
|
|
@@ -2,25 +2,32 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { deleteProductsId as e } from "../../../data-access/dist/lib/rest/sdk.gen.js";
|
|
6
|
+
import { invalidateAllClients as t } from "../../../data-access/dist/lib/clientRegistry.js";
|
|
7
7
|
import { useEmbedApi as n } from "../../../data-access/dist/lib/EmbedApiContext.js";
|
|
8
8
|
import { organizationHeaders as r } from "../../../data-access/dist/lib/organizationHeaders.js";
|
|
9
9
|
import "../../../data-access/dist/index.js";
|
|
10
|
-
import {
|
|
10
|
+
import { productsInvalidationKey as i } from "./index5.js";
|
|
11
|
+
import { useMutation as a } from "@tanstack/react-query";
|
|
11
12
|
//#region ../../libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index8.js
|
|
12
|
-
function
|
|
13
|
-
let { client:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
function o() {
|
|
14
|
+
let { client: o, organizationId: s } = n();
|
|
15
|
+
return a({
|
|
16
|
+
mutationFn: async ({ path: t }) => {
|
|
17
|
+
await e({
|
|
18
|
+
client: o,
|
|
19
|
+
headers: r(s),
|
|
20
|
+
path: t,
|
|
21
|
+
throwOnError: !0
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
onSuccess: async () => {
|
|
25
|
+
await t(i({
|
|
26
|
+
client: o,
|
|
27
|
+
organizationId: s
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
23
30
|
});
|
|
24
31
|
}
|
|
25
32
|
//#endregion
|
|
26
|
-
export {
|
|
33
|
+
export { o as useDeleteProductMutation };
|
|
@@ -2,26 +2,25 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
5
|
+
import { getMeasureUnitsOptions as e } from "../../../data-access/dist/lib/rest/@tanstack/react-query.gen.js";
|
|
6
6
|
import { withAuthEpoch as t } from "../../../data-access/dist/lib/withAuthEpoch.js";
|
|
7
7
|
import { useEmbedApi as n } from "../../../data-access/dist/lib/EmbedApiContext.js";
|
|
8
8
|
import { organizationHeaders as r } from "../../../data-access/dist/lib/organizationHeaders.js";
|
|
9
9
|
import "../../../data-access/dist/index.js";
|
|
10
10
|
import { useQuery as i } from "@tanstack/react-query";
|
|
11
11
|
//#region ../../libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index9.js
|
|
12
|
-
function a(
|
|
13
|
-
let { client:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
headers: r(s)
|
|
12
|
+
function a() {
|
|
13
|
+
let { client: a, organizationId: o, widgetToken: s, authEpoch: c, organizationPending: l } = n(), u = !!(o && s), d = e({
|
|
14
|
+
client: a,
|
|
15
|
+
headers: r(o)
|
|
17
16
|
});
|
|
18
17
|
return i({
|
|
19
|
-
...t(
|
|
20
|
-
authEpoch:
|
|
21
|
-
organizationPending:
|
|
18
|
+
...t(d, {
|
|
19
|
+
authEpoch: c,
|
|
20
|
+
organizationPending: l
|
|
22
21
|
}),
|
|
23
|
-
enabled:
|
|
22
|
+
enabled: u
|
|
24
23
|
});
|
|
25
24
|
}
|
|
26
25
|
//#endregion
|
|
27
|
-
export { a as
|
|
26
|
+
export { a as useMeasureUnitsQuery };
|
package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/index.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import "../../../util/dist/lib/apiErrors.js";
|
|
2
2
|
import { PRODUCT_MESSAGE_LABELS_EN as e } from "./lib/labels.js";
|
|
3
|
-
import {
|
|
4
|
-
import { ProductFormSheet as
|
|
3
|
+
import { buildProductDetailsView as t, buildProductRows as n, getCurrencyOptions as r, hasSelectedText as i } from "./lib/helpers.js";
|
|
4
|
+
import { ProductFormSheet as a } from "../../ui/dist/index3.js";
|
|
5
5
|
import "../../ui/dist/index4.js";
|
|
6
6
|
import "../../ui/dist/index5.js";
|
|
7
7
|
import "../../ui/dist/index.js";
|
|
8
|
-
import { useProductsQuery as
|
|
9
|
-
import
|
|
10
|
-
import "../../data-access/dist/
|
|
8
|
+
import { useProductsQuery as o } from "../../data-access/dist/index2.js";
|
|
9
|
+
import "../../data-access/dist/index3.js";
|
|
10
|
+
import { useProductQuery as s } from "../../data-access/dist/index4.js";
|
|
11
11
|
import "../../data-access/dist/index6.js";
|
|
12
|
-
import
|
|
13
|
-
import "../../data-access/dist/index8.js";
|
|
14
|
-
import "../../data-access/dist/index9.js";
|
|
12
|
+
import "../../data-access/dist/index7.js";
|
|
13
|
+
import { useDeleteProductMutation as c } from "../../data-access/dist/index8.js";
|
|
14
|
+
import { useMeasureUnitsQuery as l } from "../../data-access/dist/index9.js";
|
|
15
15
|
import "../../data-access/dist/index10.js";
|
|
16
16
|
import "../../data-access/dist/index11.js";
|
|
17
17
|
import "../../data-access/dist/index12.js";
|
|
18
|
+
import "../../data-access/dist/index13.js";
|
|
18
19
|
import "../../data-access/dist/index.js";
|
|
19
20
|
import { MeasureUnitsManagerContainer as u } from "./lib/MeasureUnitsManagerContainer.js";
|
|
20
21
|
import { useMeasureUnits as d } from "./lib/useMeasureUnits.js";
|
|
21
22
|
import { useProductForm as f } from "./lib/useProductForm.js";
|
|
22
23
|
import "./lib/useProductSelector.js";
|
|
23
24
|
import { ProductSelector as p } from "./lib/ProductSelector.js";
|
|
24
|
-
export {
|
|
25
|
+
export { u as MeasureUnitsManagerContainer, e as PRODUCT_MESSAGE_LABELS_EN, a as ProductFormSheet, p as ProductSelector, t as buildProductDetailsView, n as buildProductRows, r as getCurrencyOptions, i as hasSelectedText, c as useDeleteProductMutation, d as useMeasureUnits, l as useMeasureUnitsQuery, f as useProductForm, s as useProductQuery, o as useProductsQuery };
|
|
@@ -8,11 +8,11 @@ import { formatPrice as n, validateMeasureUnit as r } from "./helpers.js";
|
|
|
8
8
|
import { MeasureUnitsManager as i } from "../../../ui/dist/index4.js";
|
|
9
9
|
import { MeasureUnitDeleteDialog as a } from "../../../ui/dist/index5.js";
|
|
10
10
|
import "../../../ui/dist/index.js";
|
|
11
|
-
import { useMeasureUnitsQuery as o } from "../../../data-access/dist/
|
|
12
|
-
import { useProductsByMeasureUnitQuery as s } from "../../../data-access/dist/
|
|
13
|
-
import { useCreateMeasureUnitMutation as c } from "../../../data-access/dist/
|
|
14
|
-
import { useUpdateMeasureUnitMutation as l } from "../../../data-access/dist/
|
|
15
|
-
import { useDeleteMeasureUnitMutation as u } from "../../../data-access/dist/
|
|
11
|
+
import { useMeasureUnitsQuery as o } from "../../../data-access/dist/index9.js";
|
|
12
|
+
import { useProductsByMeasureUnitQuery as s } from "../../../data-access/dist/index10.js";
|
|
13
|
+
import { useCreateMeasureUnitMutation as c } from "../../../data-access/dist/index11.js";
|
|
14
|
+
import { useUpdateMeasureUnitMutation as l } from "../../../data-access/dist/index12.js";
|
|
15
|
+
import { useDeleteMeasureUnitMutation as u } from "../../../data-access/dist/index13.js";
|
|
16
16
|
import "../../../data-access/dist/index.js";
|
|
17
17
|
import { useCallback as d, useMemo as f, useState as p } from "react";
|
|
18
18
|
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
@@ -7,20 +7,16 @@ import "../../../ui/dist/index.js";
|
|
|
7
7
|
import { useProductSelector as t } from "./useProductSelector.js";
|
|
8
8
|
import { jsx as n } from "react/jsx-runtime";
|
|
9
9
|
//#region ../../libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/ProductSelector.js
|
|
10
|
-
function r({
|
|
11
|
-
let
|
|
12
|
-
value: r,
|
|
13
|
-
onValueChange: i,
|
|
14
|
-
limit: a,
|
|
15
|
-
debounceMs: o,
|
|
16
|
-
type: s,
|
|
17
|
-
typeLabels: d
|
|
18
|
-
});
|
|
10
|
+
function r({ disabled: r, invalid: i, inputId: a, focusOnMount: o, maxLength: s, labels: c, ...l }) {
|
|
11
|
+
let u = t(l);
|
|
19
12
|
return /* @__PURE__ */ n(e, {
|
|
20
|
-
...
|
|
21
|
-
disabled:
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
...u,
|
|
14
|
+
disabled: r,
|
|
15
|
+
invalid: i,
|
|
16
|
+
inputId: a,
|
|
17
|
+
focusOnMount: o,
|
|
18
|
+
maxLength: s,
|
|
19
|
+
labels: c
|
|
24
20
|
});
|
|
25
21
|
}
|
|
26
22
|
//#endregion
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
5
|
import { buildUnitNamesById as e, buildUnitOptions as t } from "./helpers.js";
|
|
6
|
-
import { useMeasureUnitsQuery as n } from "../../../data-access/dist/
|
|
6
|
+
import { useMeasureUnitsQuery as n } from "../../../data-access/dist/index9.js";
|
|
7
7
|
import "../../../data-access/dist/index.js";
|
|
8
8
|
import { useMemo as r } from "react";
|
|
9
9
|
//#region ../../libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useMeasureUnits.js
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"use client";
|
|
5
5
|
import { extractApiErrorMessage as e } from "../../../../util/dist/lib/apiErrors.js";
|
|
6
6
|
import { EMPTY_PRODUCT_FORM_VALUES as t, getCurrencyOptions as n, hasProductFormErrors as r, productFormValuesToRequest as i, productFormValuesToUpdateRequest as a, productToFormValues as o, validateProductForm as s } from "./helpers.js";
|
|
7
|
-
import { useCreateProductMutation as c } from "../../../data-access/dist/
|
|
8
|
-
import { useUpdateProductMutation as l } from "../../../data-access/dist/
|
|
7
|
+
import { useCreateProductMutation as c } from "../../../data-access/dist/index6.js";
|
|
8
|
+
import { useUpdateProductMutation as l } from "../../../data-access/dist/index7.js";
|
|
9
9
|
import "../../../data-access/dist/index.js";
|
|
10
10
|
import { useCallback as u, useMemo as d, useState as f } from "react";
|
|
11
11
|
//#region ../../libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useProductForm.js
|
|
@@ -3,54 +3,41 @@
|
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
5
|
import { formatPrice as e } from "./helpers.js";
|
|
6
|
-
import {
|
|
7
|
-
import "../../../ui/dist/index.js";
|
|
8
|
-
import { useProductsQuery as n } from "../../../data-access/dist/index2.js";
|
|
6
|
+
import { useAllProductsQuery as t } from "../../../data-access/dist/index3.js";
|
|
9
7
|
import "../../../data-access/dist/index.js";
|
|
10
|
-
import {
|
|
8
|
+
import { useMeasureUnits as n } from "./useMeasureUnits.js";
|
|
9
|
+
import { useCallback as r, useMemo as i } from "react";
|
|
11
10
|
//#region ../../libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useProductSelector.js
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
let i = {
|
|
15
|
-
...t,
|
|
16
|
-
...r
|
|
17
|
-
};
|
|
18
|
-
return (n ?? []).map((t) => ({
|
|
11
|
+
function a(t, n = {}) {
|
|
12
|
+
return (t ?? []).map((t) => ({
|
|
19
13
|
value: t.id,
|
|
20
14
|
label: t.name,
|
|
21
|
-
|
|
22
|
-
meta: e(t.price)
|
|
15
|
+
meta: [e(t.price), t.measure_unit_id ? n[t.measure_unit_id] : ""].filter(Boolean).join(" ")
|
|
23
16
|
}));
|
|
24
17
|
}
|
|
25
|
-
function
|
|
26
|
-
let
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, [e]), i(() => {
|
|
30
|
-
let
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
h(e), t?.(e);
|
|
41
|
-
}, [t]), C = r(() => {
|
|
42
|
-
b.refetch();
|
|
43
|
-
}, [b]);
|
|
18
|
+
function o({ inputValue: e, onInputValueChange: o, onProductSelect: s, selectedProductId: c, currency: l }) {
|
|
19
|
+
let u = t({
|
|
20
|
+
currency: l || void 0,
|
|
21
|
+
enabled: !!l
|
|
22
|
+
}), { unitNamesById: d } = n(), f = i(() => [...u.data?.data ?? []].sort((e, t) => (e.name ?? "").localeCompare(t.name ?? "")), [u.data]), p = c ? f.find((e) => e.id === c) : void 0, m = i(() => {
|
|
23
|
+
let t = e.toLowerCase().trim();
|
|
24
|
+
return !t || p && p.name.toLowerCase() === t ? f : f.filter((e) => e.name.toLowerCase().includes(t));
|
|
25
|
+
}, [
|
|
26
|
+
e,
|
|
27
|
+
f,
|
|
28
|
+
p
|
|
29
|
+
]), h = i(() => a(m, d), [m, d]), g = r((e) => {
|
|
30
|
+
let t = f.find((t) => t.id === e);
|
|
31
|
+
t && s(t);
|
|
32
|
+
}, [s, f]);
|
|
44
33
|
return {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
onValueChange: S,
|
|
52
|
-
onRetry: C
|
|
34
|
+
inputValue: e,
|
|
35
|
+
onInputValueChange: o,
|
|
36
|
+
options: h,
|
|
37
|
+
value: p?.id,
|
|
38
|
+
onOptionSelect: g,
|
|
39
|
+
isLoading: u.isLoading
|
|
53
40
|
};
|
|
54
41
|
}
|
|
55
42
|
//#endregion
|
|
56
|
-
export {
|
|
43
|
+
export { a as buildProductSelectorOptions, o as useProductSelector };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ProductFormSheet as
|
|
3
|
-
import { MeasureUnitsManager as
|
|
4
|
-
import { MeasureUnitDeleteDialog as
|
|
5
|
-
import { ProductSelector as
|
|
6
|
-
export {
|
|
1
|
+
import "./index2.js";
|
|
2
|
+
import { ProductFormSheet as e } from "./index3.js";
|
|
3
|
+
import { MeasureUnitsManager as t } from "./index4.js";
|
|
4
|
+
import { MeasureUnitDeleteDialog as n } from "./index5.js";
|
|
5
|
+
import { ProductSelector as r } from "./index6.js";
|
|
6
|
+
export { n as MeasureUnitDeleteDialog, t as MeasureUnitsManager, e as ProductFormSheet, r as ProductSelector };
|
package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index2.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
//#region ../../libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index2.js
|
|
2
2
|
var e = {
|
|
3
|
-
product: "Product",
|
|
4
|
-
service: "Service"
|
|
5
|
-
}, t = {
|
|
6
3
|
createTitle: "Add a product or service",
|
|
7
4
|
headerDescription: "Save the products and services you sell so you can quickly add them as line items on invoices.",
|
|
8
5
|
editTitle: "Edit {type}",
|
|
@@ -28,7 +25,7 @@ var e = {
|
|
|
28
25
|
cancelButton: "Cancel",
|
|
29
26
|
createButton: "Save {type}",
|
|
30
27
|
saveButton: "Save"
|
|
31
|
-
},
|
|
28
|
+
}, t = {
|
|
32
29
|
title: "Manage measure units",
|
|
33
30
|
hiddenDescription: "Create, edit, and delete measure units",
|
|
34
31
|
searchPlaceholder: "Search",
|
|
@@ -43,7 +40,7 @@ var e = {
|
|
|
43
40
|
saveAction: "Save unit",
|
|
44
41
|
cancelAction: "Cancel edit",
|
|
45
42
|
emptyText: "No measure units yet."
|
|
46
|
-
},
|
|
43
|
+
}, n = {
|
|
47
44
|
titleNoItems: "Delete “{name}” unit?",
|
|
48
45
|
titleWithItems: "Delete “{name}” unit and associated items?",
|
|
49
46
|
messageNoItems: "There are no items created with this measure unit.",
|
|
@@ -52,15 +49,10 @@ var e = {
|
|
|
52
49
|
messageWithItemsHint: "Please, check the list of products and services that will get deleted:",
|
|
53
50
|
confirmButton: "Delete",
|
|
54
51
|
cancelButton: "Cancel"
|
|
55
|
-
},
|
|
56
|
-
fieldLabel: "
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
loadingText: "Loading products...",
|
|
60
|
-
emptyText: "No products found.",
|
|
61
|
-
errorText: "Could not load products.",
|
|
62
|
-
retryButton: "Retry",
|
|
63
|
-
createButton: "Create product"
|
|
52
|
+
}, r = {
|
|
53
|
+
fieldLabel: "Item name",
|
|
54
|
+
placeholder: "e.g., Office supplies",
|
|
55
|
+
emptyText: "No saved items found - type to add an item"
|
|
64
56
|
};
|
|
65
57
|
//#endregion
|
|
66
|
-
export {
|
|
58
|
+
export { t as MEASURE_UNITS_MANAGER_LABELS_EN, n as MEASURE_UNIT_DELETE_DIALOG_LABELS_EN, e as PRODUCT_FORM_SHEET_LABELS_EN, r as PRODUCT_SELECTOR_LABELS_EN };
|
package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index6.js
CHANGED
|
@@ -1,76 +1,107 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PRODUCT_SELECTOR_LABELS_EN as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Input as e, cn as t } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { PRODUCT_SELECTOR_LABELS_EN as n } from "./index2.js";
|
|
3
|
+
import { useCallback as r, useId as i, useState as a } from "react";
|
|
4
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
5
|
+
import { CheckIcon as c, Loader2Icon as l } from "lucide-react";
|
|
5
6
|
//#region ../../libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index6.js
|
|
6
|
-
function
|
|
7
|
-
let
|
|
8
|
-
...
|
|
9
|
-
...
|
|
10
|
-
}, E =
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
function u({ inputValue: u, onInputValueChange: d, options: f, value: p, onOptionSelect: m, isLoading: h, disabled: g, invalid: _, inputId: v, focusOnMount: y, maxLength: b, labels: x }) {
|
|
8
|
+
let S = {
|
|
9
|
+
...n,
|
|
10
|
+
...x
|
|
11
|
+
}, C = i(), [w, T] = a(!1), [E, D] = a(), O = f.findIndex((e) => e.value === E), k = () => {
|
|
12
|
+
T(!1), D(void 0);
|
|
13
|
+
}, A = (e) => {
|
|
14
|
+
m(e), k();
|
|
15
|
+
}, j = (e) => `${C}-option-${e}`, M = (e) => {
|
|
16
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
17
|
+
if (e.preventDefault(), T(!0), !f.length) return;
|
|
18
|
+
let t = e.key === "ArrowDown" ? Math.min(O + 1, f.length - 1) : Math.max(O - 1, 0);
|
|
19
|
+
D(f[t].value), document.getElementById(j(t))?.scrollIntoView?.({ block: "nearest" });
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (e.key === "Enter") {
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
let t = f[O];
|
|
25
|
+
w && t ? A(t.value) : k();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (e.key === "Tab" && w) {
|
|
29
|
+
let e = u.trim().toLowerCase();
|
|
30
|
+
if (!e) return;
|
|
31
|
+
let t = f.find((t) => t.label.toLowerCase() === e) ?? (f.length === 1 ? f[0] : void 0);
|
|
32
|
+
t ? A(t.value) : k();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
e.key === "Escape" && w && (e.stopPropagation(), k());
|
|
36
|
+
}, N = r((e) => {
|
|
37
|
+
e && y && e.focus();
|
|
38
|
+
}, [y]), P = w && O >= 0 ? j(O) : void 0;
|
|
39
|
+
return /* @__PURE__ */ s("div", {
|
|
40
|
+
className: "ttw:relative ttw:w-full",
|
|
13
41
|
children: [
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
42
|
+
h ? /* @__PURE__ */ o(l, { className: "ttw:pointer-events-none ttw:absolute ttw:left-3 ttw:top-1/2 ttw:size-4 ttw:-translate-y-1/2 ttw:animate-spin ttw:text-muted-foreground" }) : null,
|
|
43
|
+
/* @__PURE__ */ o(e, {
|
|
44
|
+
id: v,
|
|
45
|
+
role: "combobox",
|
|
46
|
+
"aria-label": S.fieldLabel,
|
|
47
|
+
"aria-autocomplete": "list",
|
|
48
|
+
"aria-expanded": w,
|
|
49
|
+
"aria-controls": C,
|
|
50
|
+
"aria-activedescendant": P,
|
|
51
|
+
"aria-invalid": _ || void 0,
|
|
52
|
+
autoComplete: "off",
|
|
53
|
+
ref: N,
|
|
54
|
+
maxLength: b,
|
|
55
|
+
disabled: g,
|
|
56
|
+
placeholder: S.placeholder,
|
|
57
|
+
className: t(h && "ttw:pl-9"),
|
|
58
|
+
value: u,
|
|
59
|
+
onFocus: () => T(!0),
|
|
60
|
+
onClick: () => T(!0),
|
|
61
|
+
onBlur: k,
|
|
62
|
+
onChange: (e) => {
|
|
63
|
+
d(e.target.value), T(!0), D(void 0);
|
|
64
|
+
},
|
|
65
|
+
onKeyDown: M
|
|
24
66
|
}),
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}), S ? /* @__PURE__ */ u(e, {
|
|
62
|
-
type: "button",
|
|
63
|
-
variant: "outline",
|
|
64
|
-
size: "sm",
|
|
65
|
-
onClick: S,
|
|
66
|
-
children: [/* @__PURE__ */ l(f, { className: "ttw:size-4" }), T.retryButton]
|
|
67
|
-
}) : null]
|
|
68
|
-
}) : E ? null : /* @__PURE__ */ l("p", {
|
|
69
|
-
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
70
|
-
children: T.emptyText
|
|
71
|
-
})
|
|
67
|
+
w && !g ? /* @__PURE__ */ o("div", {
|
|
68
|
+
role: "presentation",
|
|
69
|
+
className: "ttw:absolute ttw:left-0 ttw:top-full ttw:z-50 ttw:mt-1 ttw:w-full ttw:min-w-138 ttw:overflow-hidden ttw:rounded-md ttw:border ttw:border-border ttw:bg-popover ttw:text-popover-foreground ttw:shadow-md",
|
|
70
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
71
|
+
children: /* @__PURE__ */ s("ul", {
|
|
72
|
+
id: C,
|
|
73
|
+
role: "listbox",
|
|
74
|
+
"aria-label": S.fieldLabel,
|
|
75
|
+
className: "ttw:max-h-87 ttw:scroll-py-1 ttw:overflow-y-auto ttw:p-1",
|
|
76
|
+
children: [f.map((e, n) => /* @__PURE__ */ s("li", {
|
|
77
|
+
id: j(n),
|
|
78
|
+
role: "option",
|
|
79
|
+
"aria-selected": e.value === p,
|
|
80
|
+
className: t("ttw:relative ttw:flex ttw:w-full ttw:cursor-default ttw:items-center ttw:gap-2 ttw:rounded-sm ttw:py-1.5 ttw:pr-8 ttw:pl-2 ttw:text-sm ttw:select-none", n === O && "ttw:bg-accent ttw:text-accent-foreground"),
|
|
81
|
+
onMouseEnter: () => D(e.value),
|
|
82
|
+
onMouseDown: () => A(e.value),
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ o("span", {
|
|
85
|
+
className: "ttw:min-w-0 ttw:flex-1 ttw:truncate",
|
|
86
|
+
children: e.label
|
|
87
|
+
}),
|
|
88
|
+
e.meta ? /* @__PURE__ */ o("span", {
|
|
89
|
+
className: "ttw:shrink-0 ttw:text-right ttw:text-xs ttw:text-muted-foreground",
|
|
90
|
+
children: e.meta
|
|
91
|
+
}) : null,
|
|
92
|
+
e.value === p ? /* @__PURE__ */ o("span", {
|
|
93
|
+
className: "ttw:pointer-events-none ttw:absolute ttw:right-2 ttw:flex ttw:size-4 ttw:items-center ttw:justify-center",
|
|
94
|
+
children: /* @__PURE__ */ o(c, { className: "ttw:size-4" })
|
|
95
|
+
}) : null
|
|
96
|
+
]
|
|
97
|
+
}, e.value)), f.length ? null : /* @__PURE__ */ o("li", {
|
|
98
|
+
className: "ttw:py-2 ttw:text-center ttw:text-sm ttw:text-muted-foreground",
|
|
99
|
+
children: S.emptyText
|
|
100
|
+
})]
|
|
101
|
+
})
|
|
102
|
+
}) : null
|
|
72
103
|
]
|
|
73
104
|
});
|
|
74
105
|
}
|
|
75
106
|
//#endregion
|
|
76
|
-
export {
|
|
107
|
+
export { u as ProductSelector, u as default };
|