bananas-commerce-admin 0.19.4 → 0.19.6
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/esm/components/Card/CardPill.js +18 -2
- package/dist/esm/components/Card/CardPill.js.map +1 -1
- package/dist/esm/components/Chip.js +3 -0
- package/dist/esm/components/Chip.js.map +1 -1
- package/dist/esm/extensions/catalog/contrib/SiteAvailability.js +66 -0
- package/dist/esm/extensions/catalog/contrib/SiteAvailability.js.map +1 -0
- package/dist/esm/extensions/catalog/index.js +13 -0
- package/dist/esm/extensions/catalog/index.js.map +1 -1
- package/dist/esm/extensions/catalog/types/contrib.js +2 -0
- package/dist/esm/extensions/catalog/types/contrib.js.map +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/util/index.js +17 -0
- package/dist/esm/util/index.js.map +1 -1
- package/dist/types/components/Card/CardPill.d.ts +1 -0
- package/dist/types/components/Card/shared.d.ts +1 -1
- package/dist/types/components/Chip.d.ts +1 -1
- package/dist/types/components/NavRail/NavRailItem.d.ts +2 -2
- package/dist/types/components/TableCard.d.ts +1 -1
- package/dist/types/extensions/catalog/contrib/SiteAvailability.d.ts +4 -0
- package/dist/types/extensions/catalog/index.d.ts +3 -1
- package/dist/types/extensions/catalog/types/contrib.d.ts +15 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/util/index.d.ts +17 -0
- package/package.json +1 -1
- package/src/components/Card/CardPill.tsx +24 -2
- package/src/components/Card/shared.ts +1 -1
- package/src/components/Chip.tsx +3 -0
- package/src/extensions/catalog/contrib/SiteAvailability.tsx +138 -0
- package/src/extensions/catalog/index.tsx +16 -1
- package/src/extensions/catalog/types/contrib.ts +16 -0
- package/src/index.ts +1 -0
- package/src/util/index.ts +18 -0
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import CancelIcon from "@mui/icons-material/Cancel";
|
|
3
3
|
import CheckCircleIcon from "@mui/icons-material/CheckCircle";
|
|
4
|
+
import WarningIcon from "@mui/icons-material/Warning";
|
|
4
5
|
import Chip from "../Chip";
|
|
5
6
|
// TODO Logic for picking icon
|
|
6
|
-
export const CardPill = ({ label, color, icon, size = "small" }) => {
|
|
7
|
-
|
|
7
|
+
export const CardPill = ({ label, color, icon, size = "small", variant, }) => {
|
|
8
|
+
let resolvedIcon;
|
|
9
|
+
if (icon === undefined) {
|
|
10
|
+
if (color === "success") {
|
|
11
|
+
resolvedIcon = React.createElement(CheckCircleIcon, null);
|
|
12
|
+
}
|
|
13
|
+
else if (color === "warning") {
|
|
14
|
+
resolvedIcon = React.createElement(WarningIcon, null);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
resolvedIcon = React.createElement(CancelIcon, null);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
resolvedIcon = icon ?? undefined;
|
|
22
|
+
}
|
|
23
|
+
return (React.createElement(Chip, { color: color ?? "success", icon: resolvedIcon, label: label, size: size, variant: variant }));
|
|
8
24
|
};
|
|
9
25
|
export default CardPill;
|
|
10
26
|
//# sourceMappingURL=CardPill.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardPill.js","sourceRoot":"","sources":["../../../../src/components/Card/CardPill.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,UAAU,MAAM,4BAA4B,CAAC;AACpD,OAAO,eAAe,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"CardPill.js","sourceRoot":"","sources":["../../../../src/components/Card/CardPill.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,UAAU,MAAM,4BAA4B,CAAC;AACpD,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,WAAW,MAAM,6BAA6B,CAAC;AAItD,OAAO,IAAI,MAAM,SAAS,CAAC;AAS3B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AAEF,eAAe,IAAI,CAAC"}
|
|
1
|
+
{"version":3,"file":"Chip.js","sourceRoot":"","sources":["../../../src/components/Chip.tsx"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAChD,KAAK,CAAC,WAAW,CAAC;IAChB,YAAY,EAAE,CAAC;IACf,qBAAqB,EAAE;QACrB,MAAM,EAAE,EAAE;KACX;IACD,sBAAsB,EAAE;QACtB,EAAE,EAAE,CAAC;KACN;IACD,gBAAgB,EAAE;QAChB,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB;KAC/C;CACF,CAAC,CACH,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import LocalOfferOutlinedIcon from "@mui/icons-material/LocalOfferOutlined";
|
|
3
|
+
import ReportIcon from "@mui/icons-material/Report";
|
|
4
|
+
import WarningIcon from "@mui/icons-material/Warning";
|
|
5
|
+
import { Grid2 as Grid, Stack, Typography } from "@mui/material";
|
|
6
|
+
import Card from "../../../components/Card";
|
|
7
|
+
import CardContent from "../../../components/Card/CardContent";
|
|
8
|
+
import CardHeader from "../../../components/Card/CardHeader";
|
|
9
|
+
import CardPill from "../../../components/Card/CardPill";
|
|
10
|
+
import Content from "../../../containers/Content";
|
|
11
|
+
const parseStatus = (value) => {
|
|
12
|
+
if (!value) {
|
|
13
|
+
return { codes: [] };
|
|
14
|
+
}
|
|
15
|
+
const trimmed = value.trim();
|
|
16
|
+
const match = /^([^[]+)\[([^\]]*)\]>?$/.exec(trimmed);
|
|
17
|
+
if (!match) {
|
|
18
|
+
return { label: trimmed, codes: [] };
|
|
19
|
+
}
|
|
20
|
+
const [, label, codes] = match;
|
|
21
|
+
return {
|
|
22
|
+
label: label.trim(),
|
|
23
|
+
codes: codes
|
|
24
|
+
.split(",")
|
|
25
|
+
.map((code) => code.trim())
|
|
26
|
+
.filter(Boolean),
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
const formatItem = (label, value) => (React.createElement(Stack, { key: label, direction: "row", justifyContent: "space-between", spacing: 2 },
|
|
30
|
+
React.createElement(Typography, { color: "text.secondary", variant: "body2" }, label),
|
|
31
|
+
typeof value === "string" || typeof value === "number" ? (React.createElement(Typography, { variant: "body2" }, value)) : (value)));
|
|
32
|
+
const ItemCard = ({ item }) => {
|
|
33
|
+
const { label: errorLabel, codes: errorCodes } = parseStatus(item.error);
|
|
34
|
+
const { label: warningLabel, codes: warningCodes } = parseStatus(item.warning);
|
|
35
|
+
return (React.createElement(Card, null,
|
|
36
|
+
React.createElement(CardHeader, { title: item.site_code }),
|
|
37
|
+
React.createElement(CardContent, null,
|
|
38
|
+
React.createElement(Stack, { spacing: 1 },
|
|
39
|
+
formatItem("Reference", item.reference),
|
|
40
|
+
formatItem("Name", item.name),
|
|
41
|
+
formatItem("Variant", item.variant || "—"),
|
|
42
|
+
formatItem("Price", item.base_price !== item.price ? (React.createElement(Stack, { alignItems: "center", direction: "row", spacing: 1 },
|
|
43
|
+
React.createElement(Typography, { color: "text.disabled", sx: { textDecoration: "line-through" }, variant: "body2" },
|
|
44
|
+
item.base_price,
|
|
45
|
+
" ",
|
|
46
|
+
item.currency),
|
|
47
|
+
React.createElement(LocalOfferOutlinedIcon, { color: "error", fontSize: "small" }),
|
|
48
|
+
React.createElement(Typography, { color: "error", variant: "body2" },
|
|
49
|
+
item.price,
|
|
50
|
+
" ",
|
|
51
|
+
item.currency))) : (`${item.price} ${item.currency}`)),
|
|
52
|
+
React.createElement(Stack, { alignItems: "center", alignSelf: "flex-start", direction: "row", flexWrap: "wrap", gap: 1 },
|
|
53
|
+
errorLabel && React.createElement(CardPill, { color: "error", icon: React.createElement(ReportIcon, null), label: errorLabel }),
|
|
54
|
+
errorCodes.map((code) => (React.createElement(CardPill, { key: `error-${code}`, color: "error", icon: null, label: code, variant: "outlined" }))),
|
|
55
|
+
warningLabel && (React.createElement(CardPill, { color: "warning", icon: React.createElement(WarningIcon, null), label: warningLabel })),
|
|
56
|
+
warningCodes.map((code) => (React.createElement(CardPill, { key: `warning-${code}`, color: "warning", icon: null, label: code, variant: "outlined" }))),
|
|
57
|
+
React.createElement(CardPill, { color: item.is_available ? "success" : "warning", label: item.is_available ? "Available" : "Unavailable" }))))));
|
|
58
|
+
};
|
|
59
|
+
const SiteAvailability = ({ data }) => {
|
|
60
|
+
const items = data.items ?? [];
|
|
61
|
+
return (React.createElement(Content, { layout: "fullWidth" }, items.length > 0 ? (React.createElement(Grid, { container: true, columns: 12, spacing: 2, width: "100%" }, items.map((item) => (React.createElement(Grid, { key: `${item.site_code}-${item.reference}`, size: { xs: 12, md: 4 } },
|
|
62
|
+
React.createElement(Stack, { spacing: 2 },
|
|
63
|
+
React.createElement(ItemCard, { item: item }))))))) : (React.createElement(Typography, { color: "text.secondary", variant: "body2" }, "No items found"))));
|
|
64
|
+
};
|
|
65
|
+
export default SiteAvailability;
|
|
66
|
+
//# sourceMappingURL=SiteAvailability.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SiteAvailability.js","sourceRoot":"","sources":["../../../../../src/extensions/catalog/contrib/SiteAvailability.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,sBAAsB,MAAM,wCAAwC,CAAC;AAC5E,OAAO,UAAU,MAAM,4BAA4B,CAAC;AACpD,OAAO,WAAW,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEjE,OAAO,IAAI,MAAM,0BAA0B,CAAC;AAC5C,OAAO,WAAW,MAAM,sCAAsC,CAAC;AAC/D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C,EAAE,IAAI,EAAE,EAAE,EAAE;IACzE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;IAE/B,OAAO,CACL,oBAAC,OAAO,IAAC,MAAM,EAAC,WAAW,IACxB,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAClB,oBAAC,IAAI,IAAC,SAAS,QAAC,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAC,MAAM,IAClD,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,oBAAC,IAAI,IAAC,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE;QACvE,oBAAC,KAAK,IAAC,OAAO,EAAE,CAAC;YACf,oBAAC,QAAQ,IAAC,IAAI,EAAE,IAAI,GAAI,CAClB,CACH,CACR,CAAC,CACG,CACR,CAAC,CAAC,CAAC,CACF,oBAAC,UAAU,IAAC,KAAK,EAAC,gBAAgB,EAAC,OAAO,EAAC,OAAO,qBAErC,CACd,CACO,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import StorefrontIcon from "@mui/icons-material/Storefront";
|
|
1
2
|
import WorkspacesIcon from "../../assets/symbols/Workspaces";
|
|
2
3
|
export * from "./types/article";
|
|
4
|
+
export * from "./types/contrib";
|
|
3
5
|
const routes = {
|
|
4
6
|
article: {
|
|
5
7
|
create: { page: async () => (await import("./pages/article/create")).default, offline: true },
|
|
@@ -26,4 +28,15 @@ export const navigation = {
|
|
|
26
28
|
permission: "catalog.view_article",
|
|
27
29
|
},
|
|
28
30
|
};
|
|
31
|
+
export const contrib = {
|
|
32
|
+
pos: {
|
|
33
|
+
"catalog:article:detail:items": {
|
|
34
|
+
title: "Availability",
|
|
35
|
+
icon: StorefrontIcon,
|
|
36
|
+
component: async () => (await import("./contrib/SiteAvailability")).default,
|
|
37
|
+
variant: "tab",
|
|
38
|
+
permission: "catalog.view_article",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
29
42
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/extensions/catalog/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/extensions/catalog/index.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,gCAAgC,CAAC;AAI5D,OAAO,cAAc,MAAM,iCAAiC,CAAC;AAI7D,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAEhC,MAAM,MAAM,GAYR;IACF,OAAO,EAAE;QACP,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;QAC7F,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,OAAO,EAAE;QAC9E,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,OAAO,EAAE;KAC3E;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAoB;IACrC,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;QACf,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAElE,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;YACjB,OAAO;gBACL,IAAI,EAAE,IAAI,EAAE;gBACZ,GAAG,GAAG;aACP,CAAC;QACJ,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAwB;IAC7C,sBAAsB,EAAE;QACtB,IAAI,EAAE,cAAc;QACpB,UAAU,EAAE,sBAAsB;KACnC;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,OAAO,GAAwC;IAC1D,GAAG,EAAE;QACH,8BAA8B,EAAE;YAC9B,KAAK,EAAE,cAAc;YACrB,IAAI,EAAE,cAAc;YACpB,SAAS,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,4BAA4B,CAAC,CAAC,CAAC,OAAO;YAC3E,OAAO,EAAE,KAAK;YACd,UAAU,EAAE,sBAAsB;SACnC;KACF;CACO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contrib.js","sourceRoot":"","sources":["../../../../../src/extensions/catalog/types/contrib.ts"],"names":[],"mappings":""}
|
package/dist/esm/index.js
CHANGED
|
@@ -72,6 +72,7 @@ export * as subscription from "./extensions/subscription";
|
|
|
72
72
|
export * as mui from "./mui";
|
|
73
73
|
export * as themes from "./themes";
|
|
74
74
|
export * as types from "./types";
|
|
75
|
+
export * as util from "./util";
|
|
75
76
|
export { contribute } from "./util/contribute";
|
|
76
77
|
export { hasGroup } from "./util/has_group";
|
|
77
78
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,OAAO,CAAC;AACtB,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAA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ACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,WAAW,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,YAAY,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAE7B,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/esm/util/index.js
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
export * from "./contribute";
|
|
2
|
+
export * from "./country_code_formatter";
|
|
3
|
+
export * from "./form_validation";
|
|
4
|
+
export * from "./format_date";
|
|
5
|
+
export * from "./format_purchase_number";
|
|
6
|
+
export * from "./format_string";
|
|
7
|
+
export * from "./get_cookie";
|
|
8
|
+
export * from "./has_access";
|
|
9
|
+
export * from "./has_group";
|
|
10
|
+
export * from "./has_permission";
|
|
11
|
+
export * from "./is_email";
|
|
12
|
+
export * from "./is_positive_integer";
|
|
13
|
+
export * from "./is_url";
|
|
14
|
+
export * from "./pluralize";
|
|
15
|
+
export * from "./select_styles";
|
|
16
|
+
export * from "./timeline";
|
|
17
|
+
export * from "./to_title_case";
|
|
1
18
|
export function ensureTrailingSlash(path) {
|
|
2
19
|
if (path != null && !path.endsWith("/")) {
|
|
3
20
|
return `${path}/`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/util/index.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACxC,OAAO,GAAG,IAAI,GAAG,CAAC;IACpB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1C,OAAO,IAAI,IAAI,EAAE,CAAC;IACpB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,QAAQ,GAAG,GAAG;IACvD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,QAAQ,GAAG,IAAI,CAAC;IAEpB,0CAA0C;IAC1C,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9B,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;IACtD,CAAC;IAED,cAAc;IACd,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,KAAK,CAAC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AClC,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { OverridableStringUnion } from "@mui/types";
|
|
|
4
4
|
import { Pill } from "./shared";
|
|
5
5
|
export interface CardPillProps extends Pill {
|
|
6
6
|
size?: OverridableStringUnion<"small" | "medium", ChipPropsSizeOverrides>;
|
|
7
|
+
variant?: "filled" | "outlined";
|
|
7
8
|
}
|
|
8
9
|
export declare const CardPill: React.FC<CardPillProps>;
|
|
9
10
|
export default CardPill;
|
|
@@ -6,7 +6,7 @@ export interface FormOption {
|
|
|
6
6
|
export interface Pill {
|
|
7
7
|
label: string;
|
|
8
8
|
color?: "success" | "error" | "warning" | "info" | "default";
|
|
9
|
-
icon?: React.ReactElement;
|
|
9
|
+
icon?: React.ReactElement | null;
|
|
10
10
|
}
|
|
11
11
|
export interface CardFieldBaseProps extends React.PropsWithChildren {
|
|
12
12
|
formName: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const Chip: import("@emotion/styled").StyledComponent<import("@mui/material/Chip").ChipOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
2
2
|
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
3
|
-
}, "
|
|
3
|
+
}, "icon" | "variant" | "label" | "style" | "color" | "sx" | "size" | "children" | "disabled" | "classes" | "className" | "tabIndex" | "avatar" | "clickable" | "deleteIcon" | "onDelete" | "skipFocusWhenDisabled"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
4
4
|
export default Chip;
|
|
@@ -12,10 +12,10 @@ export interface NavRailItemProps extends Omit<ListItemButtonProps, "onClick"> {
|
|
|
12
12
|
}
|
|
13
13
|
export declare const StyledListItemButton: import("@emotion/styled").StyledComponent<Pick<import("@mui/material/ListItemButton").ListItemButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
14
14
|
ref?: ((instance: HTMLDivElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
15
|
-
}, "
|
|
15
|
+
}, "style" | "alignItems" | "sx" | "children" | "dense" | "disabled" | "classes" | "className" | "divider" | "autoFocus" | "tabIndex" | "action" | "selected" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableGutters">, "title" | "slot" | "style" | "alignItems" | "color" | "content" | "translate" | "sx" | "key" | "security" | "children" | "ref" | "hidden" | "dense" | "disabled" | "classes" | "className" | "divider" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "action" | "selected" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableGutters"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
16
16
|
export declare const StyledListItemIconBox: import("@emotion/styled").StyledComponent<Pick<import("@mui/system").BoxOwnProps<import("@mui/system").Theme> & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
17
17
|
ref?: ((instance: HTMLDivElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
18
|
-
}, keyof import("@mui/system").BoxOwnProps<import("@mui/system").Theme>>, "
|
|
18
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/system").Theme>>, "title" | "slot" | "style" | "content" | "translate" | "key" | "security" | "hidden" | "className" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | keyof import("@mui/system").BoxOwnProps<import("@mui/system").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
19
19
|
export declare const StyledListItemIcon: import("@emotion/styled").StyledComponent<Pick<import("@mui/material/ListItemIcon").ListItemIconProps, keyof import("@mui/material/ListItemIcon").ListItemIconProps> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
20
20
|
export declare const NavRailItem: React.FC<React.PropsWithChildren<NavRailItemProps>>;
|
|
21
21
|
declare const _default: React.NamedExoticComponent<React.PropsWithChildren<NavRailItemProps>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const TableCard: import("@emotion/styled").StyledComponent<import("@mui/material/TableContainer").TableContainerOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
2
2
|
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
3
|
-
}, "
|
|
3
|
+
}, "style" | "sx" | "children" | "classes" | "className"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
4
4
|
export default TableCard;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { RouterExtension } from "../../router/Router";
|
|
2
|
-
import { NavigationOverrides } from "../../types";
|
|
2
|
+
import { ContribComponentMap, NavigationOverrides } from "../../types";
|
|
3
3
|
export * from "./types/article";
|
|
4
|
+
export * from "./types/contrib";
|
|
4
5
|
export declare const router: RouterExtension;
|
|
5
6
|
export declare const navigation: NavigationOverrides;
|
|
7
|
+
export declare const contrib: Record<string, ContribComponentMap>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface SiteItem {
|
|
2
|
+
site_code: string;
|
|
3
|
+
currency: string;
|
|
4
|
+
reference: string;
|
|
5
|
+
name: string;
|
|
6
|
+
variant: string;
|
|
7
|
+
base_price: string;
|
|
8
|
+
price: string;
|
|
9
|
+
is_available: boolean;
|
|
10
|
+
error?: string | null;
|
|
11
|
+
warning?: string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface SiteItemsResponse {
|
|
14
|
+
items: SiteItem[];
|
|
15
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -73,5 +73,6 @@ export * as mui from "./mui";
|
|
|
73
73
|
export type { RouterExtension } from "./router/Router";
|
|
74
74
|
export * as themes from "./themes";
|
|
75
75
|
export * as types from "./types";
|
|
76
|
+
export * as util from "./util";
|
|
76
77
|
export { contribute } from "./util/contribute";
|
|
77
78
|
export { hasGroup } from "./util/has_group";
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
export * from "./contribute";
|
|
2
|
+
export * from "./country_code_formatter";
|
|
3
|
+
export * from "./form_validation";
|
|
4
|
+
export * from "./format_date";
|
|
5
|
+
export * from "./format_purchase_number";
|
|
6
|
+
export * from "./format_string";
|
|
7
|
+
export * from "./get_cookie";
|
|
8
|
+
export * from "./has_access";
|
|
9
|
+
export * from "./has_group";
|
|
10
|
+
export * from "./has_permission";
|
|
11
|
+
export * from "./is_email";
|
|
12
|
+
export * from "./is_positive_integer";
|
|
13
|
+
export * from "./is_url";
|
|
14
|
+
export * from "./pluralize";
|
|
15
|
+
export * from "./select_styles";
|
|
16
|
+
export * from "./timeline";
|
|
17
|
+
export * from "./to_title_case";
|
|
1
18
|
export declare function ensureTrailingSlash(path: string): string;
|
|
2
19
|
export declare function ensureLeadingHash(hash: string): string;
|
|
3
20
|
export declare function absolutePath(path: string, basename?: string): string;
|
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
import CancelIcon from "@mui/icons-material/Cancel";
|
|
4
4
|
import CheckCircleIcon from "@mui/icons-material/CheckCircle";
|
|
5
|
+
import WarningIcon from "@mui/icons-material/Warning";
|
|
5
6
|
import { ChipPropsSizeOverrides } from "@mui/material/Chip";
|
|
6
7
|
import { OverridableStringUnion } from "@mui/types";
|
|
7
8
|
|
|
@@ -11,16 +12,37 @@ import { Pill } from "./shared";
|
|
|
11
12
|
|
|
12
13
|
export interface CardPillProps extends Pill {
|
|
13
14
|
size?: OverridableStringUnion<"small" | "medium", ChipPropsSizeOverrides>;
|
|
15
|
+
variant?: "filled" | "outlined";
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
// TODO Logic for picking icon
|
|
17
|
-
export const CardPill: React.FC<CardPillProps> = ({
|
|
19
|
+
export const CardPill: React.FC<CardPillProps> = ({
|
|
20
|
+
label,
|
|
21
|
+
color,
|
|
22
|
+
icon,
|
|
23
|
+
size = "small",
|
|
24
|
+
variant,
|
|
25
|
+
}) => {
|
|
26
|
+
let resolvedIcon: React.ReactElement | undefined;
|
|
27
|
+
if (icon === undefined) {
|
|
28
|
+
if (color === "success") {
|
|
29
|
+
resolvedIcon = <CheckCircleIcon />;
|
|
30
|
+
} else if (color === "warning") {
|
|
31
|
+
resolvedIcon = <WarningIcon />;
|
|
32
|
+
} else {
|
|
33
|
+
resolvedIcon = <CancelIcon />;
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
resolvedIcon = icon ?? undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
18
39
|
return (
|
|
19
40
|
<Chip
|
|
20
41
|
color={color ?? "success"}
|
|
21
|
-
icon={
|
|
42
|
+
icon={resolvedIcon}
|
|
22
43
|
label={label}
|
|
23
44
|
size={size}
|
|
45
|
+
variant={variant}
|
|
24
46
|
/>
|
|
25
47
|
);
|
|
26
48
|
};
|
|
@@ -8,7 +8,7 @@ export interface FormOption {
|
|
|
8
8
|
export interface Pill {
|
|
9
9
|
label: string;
|
|
10
10
|
color?: "success" | "error" | "warning" | "info" | "default";
|
|
11
|
-
icon?: React.ReactElement;
|
|
11
|
+
icon?: React.ReactElement | null;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export interface CardFieldBaseProps extends React.PropsWithChildren {
|
package/src/components/Chip.tsx
CHANGED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import LocalOfferOutlinedIcon from "@mui/icons-material/LocalOfferOutlined";
|
|
4
|
+
import ReportIcon from "@mui/icons-material/Report";
|
|
5
|
+
import WarningIcon from "@mui/icons-material/Warning";
|
|
6
|
+
import { Grid2 as Grid, Stack, Typography } from "@mui/material";
|
|
7
|
+
|
|
8
|
+
import Card from "../../../components/Card";
|
|
9
|
+
import CardContent from "../../../components/Card/CardContent";
|
|
10
|
+
import CardHeader from "../../../components/Card/CardHeader";
|
|
11
|
+
import CardPill from "../../../components/Card/CardPill";
|
|
12
|
+
import Content from "../../../containers/Content";
|
|
13
|
+
import { ContribComponent } from "../../../types";
|
|
14
|
+
import { SiteItem, SiteItemsResponse } from "../types/contrib";
|
|
15
|
+
|
|
16
|
+
const parseStatus = (value: string | null | undefined): { label?: string; codes: string[] } => {
|
|
17
|
+
if (!value) {
|
|
18
|
+
return { codes: [] };
|
|
19
|
+
}
|
|
20
|
+
const trimmed = value.trim();
|
|
21
|
+
const match = /^([^[]+)\[([^\]]*)\]>?$/.exec(trimmed);
|
|
22
|
+
if (!match) {
|
|
23
|
+
return { label: trimmed, codes: [] };
|
|
24
|
+
}
|
|
25
|
+
const [, label, codes] = match;
|
|
26
|
+
return {
|
|
27
|
+
label: label.trim(),
|
|
28
|
+
codes: codes
|
|
29
|
+
.split(",")
|
|
30
|
+
.map((code) => code.trim())
|
|
31
|
+
.filter(Boolean),
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const formatItem = (label: string, value: React.ReactNode) => (
|
|
36
|
+
<Stack key={label} direction="row" justifyContent="space-between" spacing={2}>
|
|
37
|
+
<Typography color="text.secondary" variant="body2">
|
|
38
|
+
{label}
|
|
39
|
+
</Typography>
|
|
40
|
+
{typeof value === "string" || typeof value === "number" ? (
|
|
41
|
+
<Typography variant="body2">{value}</Typography>
|
|
42
|
+
) : (
|
|
43
|
+
value
|
|
44
|
+
)}
|
|
45
|
+
</Stack>
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const ItemCard: React.FC<{ item: SiteItem }> = ({ item }) => {
|
|
49
|
+
const { label: errorLabel, codes: errorCodes } = parseStatus(item.error);
|
|
50
|
+
const { label: warningLabel, codes: warningCodes } = parseStatus(item.warning);
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<Card>
|
|
54
|
+
<CardHeader title={item.site_code} />
|
|
55
|
+
<CardContent>
|
|
56
|
+
<Stack spacing={1}>
|
|
57
|
+
{formatItem("Reference", item.reference)}
|
|
58
|
+
{formatItem("Name", item.name)}
|
|
59
|
+
{formatItem("Variant", item.variant || "—")}
|
|
60
|
+
{formatItem(
|
|
61
|
+
"Price",
|
|
62
|
+
item.base_price !== item.price ? (
|
|
63
|
+
<Stack alignItems="center" direction="row" spacing={1}>
|
|
64
|
+
<Typography
|
|
65
|
+
color="text.disabled"
|
|
66
|
+
sx={{ textDecoration: "line-through" }}
|
|
67
|
+
variant="body2"
|
|
68
|
+
>
|
|
69
|
+
{item.base_price} {item.currency}
|
|
70
|
+
</Typography>
|
|
71
|
+
<LocalOfferOutlinedIcon color="error" fontSize="small" />
|
|
72
|
+
<Typography color="error" variant="body2">
|
|
73
|
+
{item.price} {item.currency}
|
|
74
|
+
</Typography>
|
|
75
|
+
</Stack>
|
|
76
|
+
) : (
|
|
77
|
+
`${item.price} ${item.currency}`
|
|
78
|
+
),
|
|
79
|
+
)}
|
|
80
|
+
<Stack alignItems="center" alignSelf="flex-start" direction="row" flexWrap="wrap" gap={1}>
|
|
81
|
+
{errorLabel && <CardPill color="error" icon={<ReportIcon />} label={errorLabel} />}
|
|
82
|
+
{errorCodes.map((code) => (
|
|
83
|
+
<CardPill
|
|
84
|
+
key={`error-${code}`}
|
|
85
|
+
color="error"
|
|
86
|
+
icon={null}
|
|
87
|
+
label={code}
|
|
88
|
+
variant="outlined"
|
|
89
|
+
/>
|
|
90
|
+
))}
|
|
91
|
+
{warningLabel && (
|
|
92
|
+
<CardPill color="warning" icon={<WarningIcon />} label={warningLabel} />
|
|
93
|
+
)}
|
|
94
|
+
{warningCodes.map((code) => (
|
|
95
|
+
<CardPill
|
|
96
|
+
key={`warning-${code}`}
|
|
97
|
+
color="warning"
|
|
98
|
+
icon={null}
|
|
99
|
+
label={code}
|
|
100
|
+
variant="outlined"
|
|
101
|
+
/>
|
|
102
|
+
))}
|
|
103
|
+
<CardPill
|
|
104
|
+
color={item.is_available ? "success" : "warning"}
|
|
105
|
+
label={item.is_available ? "Available" : "Unavailable"}
|
|
106
|
+
/>
|
|
107
|
+
</Stack>
|
|
108
|
+
</Stack>
|
|
109
|
+
</CardContent>
|
|
110
|
+
</Card>
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const SiteAvailability: ContribComponent<SiteItemsResponse> = ({ data }) => {
|
|
115
|
+
const items = data.items ?? [];
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<Content layout="fullWidth">
|
|
119
|
+
{items.length > 0 ? (
|
|
120
|
+
<Grid container columns={12} spacing={2} width="100%">
|
|
121
|
+
{items.map((item) => (
|
|
122
|
+
<Grid key={`${item.site_code}-${item.reference}`} size={{ xs: 12, md: 4 }}>
|
|
123
|
+
<Stack spacing={2}>
|
|
124
|
+
<ItemCard item={item} />
|
|
125
|
+
</Stack>
|
|
126
|
+
</Grid>
|
|
127
|
+
))}
|
|
128
|
+
</Grid>
|
|
129
|
+
) : (
|
|
130
|
+
<Typography color="text.secondary" variant="body2">
|
|
131
|
+
No items found
|
|
132
|
+
</Typography>
|
|
133
|
+
)}
|
|
134
|
+
</Content>
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export default SiteAvailability;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import StorefrontIcon from "@mui/icons-material/Storefront";
|
|
2
|
+
|
|
1
3
|
import { OpenAPI } from "openapi-types";
|
|
2
4
|
|
|
3
5
|
import WorkspacesIcon from "../../assets/symbols/Workspaces";
|
|
4
6
|
import { RouterExtension } from "../../router/Router";
|
|
5
|
-
import { NavigationOverrides, PageComponent } from "../../types";
|
|
7
|
+
import { ContribComponentMap, NavigationOverrides, PageComponent } from "../../types";
|
|
6
8
|
|
|
7
9
|
export * from "./types/article";
|
|
10
|
+
export * from "./types/contrib";
|
|
8
11
|
|
|
9
12
|
const routes: Record<
|
|
10
13
|
string,
|
|
@@ -48,3 +51,15 @@ export const navigation: NavigationOverrides = {
|
|
|
48
51
|
permission: "catalog.view_article",
|
|
49
52
|
},
|
|
50
53
|
} as const;
|
|
54
|
+
|
|
55
|
+
export const contrib: Record<string, ContribComponentMap> = {
|
|
56
|
+
pos: {
|
|
57
|
+
"catalog:article:detail:items": {
|
|
58
|
+
title: "Availability",
|
|
59
|
+
icon: StorefrontIcon,
|
|
60
|
+
component: async () => (await import("./contrib/SiteAvailability")).default,
|
|
61
|
+
variant: "tab",
|
|
62
|
+
permission: "catalog.view_article",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
} as const;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface SiteItem {
|
|
2
|
+
site_code: string;
|
|
3
|
+
currency: string;
|
|
4
|
+
reference: string;
|
|
5
|
+
name: string;
|
|
6
|
+
variant: string;
|
|
7
|
+
base_price: string;
|
|
8
|
+
price: string;
|
|
9
|
+
is_available: boolean;
|
|
10
|
+
error?: string | null;
|
|
11
|
+
warning?: string | null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface SiteItemsResponse {
|
|
15
|
+
items: SiteItem[];
|
|
16
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -73,5 +73,6 @@ export * as mui from "./mui";
|
|
|
73
73
|
export type { RouterExtension } from "./router/Router";
|
|
74
74
|
export * as themes from "./themes";
|
|
75
75
|
export * as types from "./types";
|
|
76
|
+
export * as util from "./util";
|
|
76
77
|
export { contribute } from "./util/contribute";
|
|
77
78
|
export { hasGroup } from "./util/has_group";
|
package/src/util/index.ts
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
export * from "./contribute";
|
|
2
|
+
export * from "./country_code_formatter";
|
|
3
|
+
export * from "./form_validation";
|
|
4
|
+
export * from "./format_date";
|
|
5
|
+
export * from "./format_purchase_number";
|
|
6
|
+
export * from "./format_string";
|
|
7
|
+
export * from "./get_cookie";
|
|
8
|
+
export * from "./has_access";
|
|
9
|
+
export * from "./has_group";
|
|
10
|
+
export * from "./has_permission";
|
|
11
|
+
export * from "./is_email";
|
|
12
|
+
export * from "./is_positive_integer";
|
|
13
|
+
export * from "./is_url";
|
|
14
|
+
export * from "./pluralize";
|
|
15
|
+
export * from "./select_styles";
|
|
16
|
+
export * from "./timeline";
|
|
17
|
+
export * from "./to_title_case";
|
|
18
|
+
|
|
1
19
|
export function ensureTrailingSlash(path: string): string {
|
|
2
20
|
if (path != null && !path.endsWith("/")) {
|
|
3
21
|
return `${path}/`;
|