@enyxs/wikex-components 0.11.50 → 0.11.51
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 +4 -0
- package/dist/chrome-model.js +23 -0
- package/dist/chrome-model.mjs +23 -0
- package/dist/fees.js +26 -12
- package/dist/fees.mjs +26 -12
- package/dist/index.js +165 -82
- package/dist/index.mjs +165 -82
- package/dist/products.js +26 -12
- package/dist/products.mjs +26 -12
- package/dist/ui.d.mts +2 -1
- package/dist/ui.d.ts +2 -1
- package/dist/ui.js +26 -12
- package/dist/ui.mjs +26 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -55,6 +55,10 @@ The package has React, Material UI and Emotion as peer dependencies, so the host
|
|
|
55
55
|
|
|
56
56
|
## Release
|
|
57
57
|
|
|
58
|
+
### 0.11.51
|
|
59
|
+
|
|
60
|
+
Promotes the tested sitelinks prerelease to a stable npm release. Includes crawlable header parent/submenu links, independent dropdown controls, safe footer category defaults, a semantic landing H1, and optional URL-based pagination. Existing CMS navigation data remains supported. Frontend and backend can pin this published version instead of the local prerelease tarball.
|
|
61
|
+
|
|
58
62
|
### 0.11.50
|
|
59
63
|
|
|
60
64
|
Audit fixes. Partner art ships as WebP at 2× display size (npm tarball 32 MB → 1.6 MB). Each breakpoint downloads only its own variant, and below-the-fold art loads lazily. Saved `/partner-assets/*.png` overrides are mapped to the new `.webp` files. Every CMS-controlled href now goes through the `safeCmsTextHref` link policy. `#` links and disabled header items are never marked as the current page. Package blocks render `<div>` roots instead of `<main>`. The legacy `commodity-partner-registration` block submits `kind: partner` with a region. The complaints support form is disabled with a contact note, because no backend accepts it yet. The dead Lenis/Swiper code is removed. `i18next`, `lucide`, `morphicons` and `radix-ui` are now peer dependencies (UI peers are optional for model-only consumers), and `next` is bounded to `>=16 <17`. Exports use nested `types` conditions and add `./package.json` and `./chrome/model/styles.css`. Frontend and backend must pin the same published version.
|
package/dist/chrome-model.js
CHANGED
|
@@ -1158,6 +1158,29 @@ function migrateWikexChromeContent(type, content) {
|
|
|
1158
1158
|
delete result[key + "Color"];
|
|
1159
1159
|
delete result[key + "TextLayout"];
|
|
1160
1160
|
}
|
|
1161
|
+
if (type === "commodity-footer") for (const language of ["vi", "en"]) {
|
|
1162
|
+
const key = `${language}.footer.productLinks`;
|
|
1163
|
+
const items = parseChromeItems(result[key]);
|
|
1164
|
+
if (!items) continue;
|
|
1165
|
+
const categories = {
|
|
1166
|
+
"kim lo\u1EA1i": "metal",
|
|
1167
|
+
"metals": "metal",
|
|
1168
|
+
"metal": "metal",
|
|
1169
|
+
"n\xF4ng s\u1EA3n": "agriculture",
|
|
1170
|
+
"agriculture": "agriculture",
|
|
1171
|
+
"agricultural products": "agriculture",
|
|
1172
|
+
"c\xF4ng nghi\u1EC7p": "industrial",
|
|
1173
|
+
"nguy\xEAn li\u1EC7u c\xF4ng nghi\u1EC7p": "industrial",
|
|
1174
|
+
"industrial": "industrial",
|
|
1175
|
+
"industrial materials": "industrial",
|
|
1176
|
+
"n\u0103ng l\u01B0\u1EE3ng": "energy",
|
|
1177
|
+
"energy": "energy"
|
|
1178
|
+
};
|
|
1179
|
+
result[key] = JSON.stringify(items.map((item) => {
|
|
1180
|
+
const category = categories[item.label?.trim().toLocaleLowerCase("vi")];
|
|
1181
|
+
return category && /^\/(?:products|san-pham)\/?$/.test(item.href ?? "") ? { ...item, href: `${item.href.replace(/\/$/, "")}/?category=${category}` } : item;
|
|
1182
|
+
}));
|
|
1183
|
+
}
|
|
1161
1184
|
return result;
|
|
1162
1185
|
}
|
|
1163
1186
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/chrome-model.mjs
CHANGED
|
@@ -1132,6 +1132,29 @@ function migrateWikexChromeContent(type, content) {
|
|
|
1132
1132
|
delete result[key + "Color"];
|
|
1133
1133
|
delete result[key + "TextLayout"];
|
|
1134
1134
|
}
|
|
1135
|
+
if (type === "commodity-footer") for (const language of ["vi", "en"]) {
|
|
1136
|
+
const key = `${language}.footer.productLinks`;
|
|
1137
|
+
const items = parseChromeItems(result[key]);
|
|
1138
|
+
if (!items) continue;
|
|
1139
|
+
const categories = {
|
|
1140
|
+
"kim lo\u1EA1i": "metal",
|
|
1141
|
+
"metals": "metal",
|
|
1142
|
+
"metal": "metal",
|
|
1143
|
+
"n\xF4ng s\u1EA3n": "agriculture",
|
|
1144
|
+
"agriculture": "agriculture",
|
|
1145
|
+
"agricultural products": "agriculture",
|
|
1146
|
+
"c\xF4ng nghi\u1EC7p": "industrial",
|
|
1147
|
+
"nguy\xEAn li\u1EC7u c\xF4ng nghi\u1EC7p": "industrial",
|
|
1148
|
+
"industrial": "industrial",
|
|
1149
|
+
"industrial materials": "industrial",
|
|
1150
|
+
"n\u0103ng l\u01B0\u1EE3ng": "energy",
|
|
1151
|
+
"energy": "energy"
|
|
1152
|
+
};
|
|
1153
|
+
result[key] = JSON.stringify(items.map((item) => {
|
|
1154
|
+
const category = categories[item.label?.trim().toLocaleLowerCase("vi")];
|
|
1155
|
+
return category && /^\/(?:products|san-pham)\/?$/.test(item.href ?? "") ? { ...item, href: `${item.href.replace(/\/$/, "")}/?category=${category}` } : item;
|
|
1156
|
+
}));
|
|
1157
|
+
}
|
|
1135
1158
|
return result;
|
|
1136
1159
|
}
|
|
1137
1160
|
export {
|
package/dist/fees.js
CHANGED
|
@@ -797,24 +797,24 @@ var chevron_right_default = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL
|
|
|
797
797
|
// src/commodity-original/components/Pagination/style.ts
|
|
798
798
|
var import_styled_components2 = require("styled-components");
|
|
799
799
|
var PaginationNav = import_styled_components2.styled.nav.withConfig({
|
|
800
|
-
componentId: "sc-
|
|
800
|
+
componentId: "sc-e6c46071-0"
|
|
801
801
|
})([
|
|
802
802
|
`display:flex;justify-content:center;`
|
|
803
803
|
]);
|
|
804
804
|
var PaginationList = import_styled_components2.styled.ul.withConfig({
|
|
805
|
-
componentId: "sc-
|
|
805
|
+
componentId: "sc-e6c46071-1"
|
|
806
806
|
})([
|
|
807
807
|
`display:flex;margin:0;padding:0;align-items:center;gap:8px;list-style:none;`
|
|
808
808
|
]);
|
|
809
809
|
var PaginationItem = import_styled_components2.styled.li.withConfig({
|
|
810
|
-
componentId: "sc-
|
|
810
|
+
componentId: "sc-e6c46071-2"
|
|
811
811
|
})([
|
|
812
812
|
`display:flex;`
|
|
813
813
|
]);
|
|
814
814
|
var PaginationButton = import_styled_components2.styled.button.withConfig({
|
|
815
|
-
componentId: "sc-
|
|
815
|
+
componentId: "sc-e6c46071-3"
|
|
816
816
|
})([
|
|
817
|
-
`display:inline-flex;width:28px;height:28px;align-items:center;justify-content:center;border:1px solid `,
|
|
817
|
+
`box-sizing:border-box;text-decoration:none;display:inline-flex;width:28px;height:28px;align-items:center;justify-content:center;border:1px solid `,
|
|
818
818
|
`;border-radius:4px;padding:4px;color:`,
|
|
819
819
|
`;background:`,
|
|
820
820
|
`;font-family:var(--font-manrope),Arial,Helvetica,sans-serif;font-size:14px;font-weight:500;line-height:18px;cursor:pointer;transition:color 160ms ease,background-color 160ms ease,border-color 160ms ease;&[data-control]{border-color:transparent;background:transparent;}&[data-active]{border-color:`,
|
|
@@ -827,7 +827,7 @@ var PaginationButton = import_styled_components2.styled.button.withConfig({
|
|
|
827
827
|
`;outline-offset:2px;}`
|
|
828
828
|
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.text.secondary, ({ theme }) => theme.colors.background.canvas, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.accent.foreground, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.background.hover, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.accent.primary);
|
|
829
829
|
var PaginationArrow = import_styled_components2.styled.span.withConfig({
|
|
830
|
-
componentId: "sc-
|
|
830
|
+
componentId: "sc-e6c46071-4"
|
|
831
831
|
})([
|
|
832
832
|
`width:16px;height:16px;background:currentColor;mask:url("`,
|
|
833
833
|
`") center / contain no-repeat;-webkit-mask:url("`,
|
|
@@ -860,6 +860,7 @@ function Pagination({
|
|
|
860
860
|
page,
|
|
861
861
|
pageCount,
|
|
862
862
|
onPageChange,
|
|
863
|
+
getPageHref,
|
|
863
864
|
siblingCount = 1,
|
|
864
865
|
ariaLabel,
|
|
865
866
|
labels: labels2,
|
|
@@ -871,6 +872,13 @@ function Pagination({
|
|
|
871
872
|
const items = getPaginationItems(currentPage, safePageCount, siblingCount);
|
|
872
873
|
const hasPreviousPage = currentPage > 1;
|
|
873
874
|
const hasNextPage = currentPage < safePageCount;
|
|
875
|
+
const pageClick = (page2) => (event) => {
|
|
876
|
+
if (getPageHref) {
|
|
877
|
+
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
|
878
|
+
event.preventDefault();
|
|
879
|
+
}
|
|
880
|
+
onPageChange(page2);
|
|
881
|
+
};
|
|
874
882
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
875
883
|
PaginationNav,
|
|
876
884
|
{
|
|
@@ -880,33 +888,39 @@ function Pagination({
|
|
|
880
888
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
881
889
|
PaginationButton,
|
|
882
890
|
{
|
|
891
|
+
as: getPageHref && hasPreviousPage ? "a" : "button",
|
|
892
|
+
href: getPageHref && hasPreviousPage ? getPageHref(currentPage - 1) : void 0,
|
|
883
893
|
"aria-label": labels2?.previous ?? t("pagination.previous"),
|
|
884
894
|
"data-control": "previous",
|
|
885
895
|
disabled: !hasPreviousPage,
|
|
886
|
-
onClick: (
|
|
887
|
-
type: "button",
|
|
896
|
+
onClick: pageClick(currentPage - 1),
|
|
897
|
+
type: getPageHref && hasPreviousPage ? void 0 : "button",
|
|
888
898
|
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PaginationArrow, { "data-direction": "previous" })
|
|
889
899
|
}
|
|
890
900
|
) }),
|
|
891
901
|
items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PaginationItem, { children: item === "ellipsis" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PaginationButton, { "aria-hidden": "true", disabled: true, tabIndex: -1, type: "button", children: "\u2026" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
892
902
|
PaginationButton,
|
|
893
903
|
{
|
|
904
|
+
as: getPageHref ? "a" : "button",
|
|
905
|
+
href: getPageHref?.(item),
|
|
894
906
|
"aria-current": item === currentPage ? "page" : void 0,
|
|
895
907
|
"aria-label": item === currentPage ? labels2?.current(item) ?? t("pagination.current", { page: item }) : labels2?.page(item) ?? t("pagination.page", { page: item }),
|
|
896
908
|
"data-active": item === currentPage || void 0,
|
|
897
|
-
onClick: (
|
|
898
|
-
type: "button",
|
|
909
|
+
onClick: pageClick(item),
|
|
910
|
+
type: getPageHref ? void 0 : "button",
|
|
899
911
|
children: item
|
|
900
912
|
}
|
|
901
913
|
) }, `${item}-${index}`)),
|
|
902
914
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
903
915
|
PaginationButton,
|
|
904
916
|
{
|
|
917
|
+
as: getPageHref && hasNextPage ? "a" : "button",
|
|
918
|
+
href: getPageHref && hasNextPage ? getPageHref(currentPage + 1) : void 0,
|
|
905
919
|
"aria-label": labels2?.next ?? t("pagination.next"),
|
|
906
920
|
"data-control": "next",
|
|
907
921
|
disabled: !hasNextPage,
|
|
908
|
-
onClick: (
|
|
909
|
-
type: "button",
|
|
922
|
+
onClick: pageClick(currentPage + 1),
|
|
923
|
+
type: getPageHref && hasNextPage ? void 0 : "button",
|
|
910
924
|
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PaginationArrow, { "data-direction": "next" })
|
|
911
925
|
}
|
|
912
926
|
) })
|
package/dist/fees.mjs
CHANGED
|
@@ -761,24 +761,24 @@ var chevron_right_default = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL
|
|
|
761
761
|
// src/commodity-original/components/Pagination/style.ts
|
|
762
762
|
import { styled as styled2 } from "styled-components";
|
|
763
763
|
var PaginationNav = styled2.nav.withConfig({
|
|
764
|
-
componentId: "sc-
|
|
764
|
+
componentId: "sc-e6c46071-0"
|
|
765
765
|
})([
|
|
766
766
|
`display:flex;justify-content:center;`
|
|
767
767
|
]);
|
|
768
768
|
var PaginationList = styled2.ul.withConfig({
|
|
769
|
-
componentId: "sc-
|
|
769
|
+
componentId: "sc-e6c46071-1"
|
|
770
770
|
})([
|
|
771
771
|
`display:flex;margin:0;padding:0;align-items:center;gap:8px;list-style:none;`
|
|
772
772
|
]);
|
|
773
773
|
var PaginationItem = styled2.li.withConfig({
|
|
774
|
-
componentId: "sc-
|
|
774
|
+
componentId: "sc-e6c46071-2"
|
|
775
775
|
})([
|
|
776
776
|
`display:flex;`
|
|
777
777
|
]);
|
|
778
778
|
var PaginationButton = styled2.button.withConfig({
|
|
779
|
-
componentId: "sc-
|
|
779
|
+
componentId: "sc-e6c46071-3"
|
|
780
780
|
})([
|
|
781
|
-
`display:inline-flex;width:28px;height:28px;align-items:center;justify-content:center;border:1px solid `,
|
|
781
|
+
`box-sizing:border-box;text-decoration:none;display:inline-flex;width:28px;height:28px;align-items:center;justify-content:center;border:1px solid `,
|
|
782
782
|
`;border-radius:4px;padding:4px;color:`,
|
|
783
783
|
`;background:`,
|
|
784
784
|
`;font-family:var(--font-manrope),Arial,Helvetica,sans-serif;font-size:14px;font-weight:500;line-height:18px;cursor:pointer;transition:color 160ms ease,background-color 160ms ease,border-color 160ms ease;&[data-control]{border-color:transparent;background:transparent;}&[data-active]{border-color:`,
|
|
@@ -791,7 +791,7 @@ var PaginationButton = styled2.button.withConfig({
|
|
|
791
791
|
`;outline-offset:2px;}`
|
|
792
792
|
], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.text.secondary, ({ theme }) => theme.colors.background.canvas, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.accent.foreground, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.background.hover, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.accent.primary);
|
|
793
793
|
var PaginationArrow = styled2.span.withConfig({
|
|
794
|
-
componentId: "sc-
|
|
794
|
+
componentId: "sc-e6c46071-4"
|
|
795
795
|
})([
|
|
796
796
|
`width:16px;height:16px;background:currentColor;mask:url("`,
|
|
797
797
|
`") center / contain no-repeat;-webkit-mask:url("`,
|
|
@@ -824,6 +824,7 @@ function Pagination({
|
|
|
824
824
|
page,
|
|
825
825
|
pageCount,
|
|
826
826
|
onPageChange,
|
|
827
|
+
getPageHref,
|
|
827
828
|
siblingCount = 1,
|
|
828
829
|
ariaLabel,
|
|
829
830
|
labels: labels2,
|
|
@@ -835,6 +836,13 @@ function Pagination({
|
|
|
835
836
|
const items = getPaginationItems(currentPage, safePageCount, siblingCount);
|
|
836
837
|
const hasPreviousPage = currentPage > 1;
|
|
837
838
|
const hasNextPage = currentPage < safePageCount;
|
|
839
|
+
const pageClick = (page2) => (event) => {
|
|
840
|
+
if (getPageHref) {
|
|
841
|
+
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
|
842
|
+
event.preventDefault();
|
|
843
|
+
}
|
|
844
|
+
onPageChange(page2);
|
|
845
|
+
};
|
|
838
846
|
return /* @__PURE__ */ jsx4(
|
|
839
847
|
PaginationNav,
|
|
840
848
|
{
|
|
@@ -844,33 +852,39 @@ function Pagination({
|
|
|
844
852
|
/* @__PURE__ */ jsx4(PaginationItem, { children: /* @__PURE__ */ jsx4(
|
|
845
853
|
PaginationButton,
|
|
846
854
|
{
|
|
855
|
+
as: getPageHref && hasPreviousPage ? "a" : "button",
|
|
856
|
+
href: getPageHref && hasPreviousPage ? getPageHref(currentPage - 1) : void 0,
|
|
847
857
|
"aria-label": labels2?.previous ?? t("pagination.previous"),
|
|
848
858
|
"data-control": "previous",
|
|
849
859
|
disabled: !hasPreviousPage,
|
|
850
|
-
onClick: (
|
|
851
|
-
type: "button",
|
|
860
|
+
onClick: pageClick(currentPage - 1),
|
|
861
|
+
type: getPageHref && hasPreviousPage ? void 0 : "button",
|
|
852
862
|
children: /* @__PURE__ */ jsx4(PaginationArrow, { "data-direction": "previous" })
|
|
853
863
|
}
|
|
854
864
|
) }),
|
|
855
865
|
items.map((item, index) => /* @__PURE__ */ jsx4(PaginationItem, { children: item === "ellipsis" ? /* @__PURE__ */ jsx4(PaginationButton, { "aria-hidden": "true", disabled: true, tabIndex: -1, type: "button", children: "\u2026" }) : /* @__PURE__ */ jsx4(
|
|
856
866
|
PaginationButton,
|
|
857
867
|
{
|
|
868
|
+
as: getPageHref ? "a" : "button",
|
|
869
|
+
href: getPageHref?.(item),
|
|
858
870
|
"aria-current": item === currentPage ? "page" : void 0,
|
|
859
871
|
"aria-label": item === currentPage ? labels2?.current(item) ?? t("pagination.current", { page: item }) : labels2?.page(item) ?? t("pagination.page", { page: item }),
|
|
860
872
|
"data-active": item === currentPage || void 0,
|
|
861
|
-
onClick: (
|
|
862
|
-
type: "button",
|
|
873
|
+
onClick: pageClick(item),
|
|
874
|
+
type: getPageHref ? void 0 : "button",
|
|
863
875
|
children: item
|
|
864
876
|
}
|
|
865
877
|
) }, `${item}-${index}`)),
|
|
866
878
|
/* @__PURE__ */ jsx4(PaginationItem, { children: /* @__PURE__ */ jsx4(
|
|
867
879
|
PaginationButton,
|
|
868
880
|
{
|
|
881
|
+
as: getPageHref && hasNextPage ? "a" : "button",
|
|
882
|
+
href: getPageHref && hasNextPage ? getPageHref(currentPage + 1) : void 0,
|
|
869
883
|
"aria-label": labels2?.next ?? t("pagination.next"),
|
|
870
884
|
"data-control": "next",
|
|
871
885
|
disabled: !hasNextPage,
|
|
872
|
-
onClick: (
|
|
873
|
-
type: "button",
|
|
886
|
+
onClick: pageClick(currentPage + 1),
|
|
887
|
+
type: getPageHref && hasNextPage ? void 0 : "button",
|
|
874
888
|
children: /* @__PURE__ */ jsx4(PaginationArrow, { "data-direction": "next" })
|
|
875
889
|
}
|
|
876
890
|
) })
|