@enyxs/wikex-components 0.8.18 → 0.8.19
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/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +55 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5,9 +5,10 @@ type CmsFieldType = "text" | "textarea" | "richText" | "image" | "link" | "numbe
|
|
|
5
5
|
type CmsListItemField = {
|
|
6
6
|
key: string;
|
|
7
7
|
label: string;
|
|
8
|
-
type: "text" | "textarea" | "richText" | "link" | "image";
|
|
8
|
+
type: "text" | "textarea" | "richText" | "link" | "image" | "list";
|
|
9
9
|
placeholder?: string;
|
|
10
10
|
required?: boolean;
|
|
11
|
+
itemFields?: CmsListItemField[];
|
|
11
12
|
};
|
|
12
13
|
type CmsFieldDefinition = {
|
|
13
14
|
key: string;
|
|
@@ -56,6 +57,9 @@ type CmsTextTarget = {
|
|
|
56
57
|
listField?: string;
|
|
57
58
|
itemIndex?: number;
|
|
58
59
|
itemKey?: string;
|
|
60
|
+
nestedListField?: string;
|
|
61
|
+
nestedItemIndex?: number;
|
|
62
|
+
nestedItemKey?: string;
|
|
59
63
|
currentColor?: string;
|
|
60
64
|
};
|
|
61
65
|
type CmsBlock = {
|
package/dist/index.d.ts
CHANGED
|
@@ -5,9 +5,10 @@ type CmsFieldType = "text" | "textarea" | "richText" | "image" | "link" | "numbe
|
|
|
5
5
|
type CmsListItemField = {
|
|
6
6
|
key: string;
|
|
7
7
|
label: string;
|
|
8
|
-
type: "text" | "textarea" | "richText" | "link" | "image";
|
|
8
|
+
type: "text" | "textarea" | "richText" | "link" | "image" | "list";
|
|
9
9
|
placeholder?: string;
|
|
10
10
|
required?: boolean;
|
|
11
|
+
itemFields?: CmsListItemField[];
|
|
11
12
|
};
|
|
12
13
|
type CmsFieldDefinition = {
|
|
13
14
|
key: string;
|
|
@@ -56,6 +57,9 @@ type CmsTextTarget = {
|
|
|
56
57
|
listField?: string;
|
|
57
58
|
itemIndex?: number;
|
|
58
59
|
itemKey?: string;
|
|
60
|
+
nestedListField?: string;
|
|
61
|
+
nestedItemIndex?: number;
|
|
62
|
+
nestedItemKey?: string;
|
|
59
63
|
currentColor?: string;
|
|
60
64
|
};
|
|
61
65
|
type CmsBlock = {
|
package/dist/index.js
CHANGED
|
@@ -3632,10 +3632,21 @@ var headerDefaults = {
|
|
|
3632
3632
|
ctaUrl: "#lien-he"
|
|
3633
3633
|
};
|
|
3634
3634
|
function EstateHeaderRenderer(props) {
|
|
3635
|
+
const navigation = cmsListItems(
|
|
3636
|
+
props.content,
|
|
3637
|
+
[1, 2, 3, 4].map((index) => ({
|
|
3638
|
+
label: String(value4(props.content, `nav${index}Label`, headerDefaults[`nav${index}Label`])),
|
|
3639
|
+
url: String(value4(props.content, `nav${index}Url`, headerDefaults[`nav${index}Url`]))
|
|
3640
|
+
}))
|
|
3641
|
+
);
|
|
3635
3642
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_Box5.default, { component: "header", sx: { ...estateResponsiveSx, position: "relative", zIndex: props.editable ? 1 : 10, borderBottom: "1px solid rgba(255,255,255,.16)", bgcolor: palette.dark, color: "white", px: { xs: 2, md: 4 } }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_Box5.default, { className: "estate-container", sx: { display: "flex", minHeight: { xs: 76, md: 96 }, maxWidth: 1376, mx: "auto", alignItems: "center", justifyContent: "space-between", gap: 2 }, children: [
|
|
3636
3643
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(EstateLogo, { props, fallback: headerDefaults.logo }),
|
|
3637
3644
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_Stack3.default, { component: "nav", direction: "row", spacing: { md: 3, lg: 4 }, sx: { alignItems: "center", "@container (max-width: 767px)": { display: "none" } }, children: [
|
|
3638
|
-
|
|
3645
|
+
navigation.map((item, itemIndex) => {
|
|
3646
|
+
const index = itemIndex + 1;
|
|
3647
|
+
const navigable = cmsListItemLinkEnabled(item, "url") && !props.editable;
|
|
3648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_Button5.default, { "data-cms-list-field": "items", "data-cms-list-item-index": itemIndex, component: navigable ? "a" : "div", href: navigable ? item.url || "#" : void 0, "aria-disabled": !navigable, sx: { minWidth: 0, p: 0, color: "inherit", fontSize: 12, fontWeight: 600, textTransform: "none", "&:hover": { bgcolor: "transparent", opacity: 0.6 } }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { props, field: `nav${index}Label`, fallback: item.label, children: (node) => node }) }, index);
|
|
3649
|
+
}),
|
|
3639
3650
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_Button5.default, { component: "a", href: String(value4(props.content, "ctaUrl", headerDefaults.ctaUrl)), sx: { minHeight: 42, borderRadius: 99, px: 2, bgcolor: "#C2A268", color: palette.ink, fontSize: 11, fontWeight: 800, letterSpacing: ".08em" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { props, field: "ctaLabel", fallback: headerDefaults.ctaLabel, children: (node) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
3640
3651
|
node,
|
|
3641
3652
|
" \u2197"
|
|
@@ -3653,23 +3664,34 @@ var estateHeaderBlock = {
|
|
|
3653
3664
|
), headerDefaults, "header"),
|
|
3654
3665
|
Renderer: EstateHeaderRenderer
|
|
3655
3666
|
};
|
|
3667
|
+
var footerNavigationItems = [
|
|
3668
|
+
{ label: "V\u1EC1 Wikex Estates", url: "#gioi-thieu", urlEnabled: "true" },
|
|
3669
|
+
{ label: "D\u1ECBch v\u1EE5", url: "#dich-vu", urlEnabled: "true" },
|
|
3670
|
+
{ label: "D\u1EF1 \xE1n", url: "#du-an", urlEnabled: "true" },
|
|
3671
|
+
{ label: "C\u1EA9m nang", url: "#cam-nang", urlEnabled: "true" }
|
|
3672
|
+
];
|
|
3673
|
+
var footerNavigationDefaults = [
|
|
3674
|
+
{ title: "KH\xC1M PH\xC1", items: JSON.stringify(footerNavigationItems) }
|
|
3675
|
+
];
|
|
3656
3676
|
var footerDefaults = {
|
|
3657
3677
|
logo: wikex_estates_logo_default,
|
|
3658
3678
|
statement: "Ki\u1EBFn t\u1EA1o n\u01A1i ch\u1ED1n mang d\u1EA5u \u1EA5n ri\xEAng v\xE0 gi\xE1 tr\u1ECB b\u1EC1n v\u1EEFng theo th\u1EDDi gian.",
|
|
3659
3679
|
email: "hello@wikex.vn",
|
|
3660
|
-
|
|
3661
|
-
nav1Url: "#gioi-thieu",
|
|
3662
|
-
nav2Label: "D\u1ECBch v\u1EE5",
|
|
3663
|
-
nav2Url: "#dich-vu",
|
|
3664
|
-
nav3Label: "D\u1EF1 \xE1n",
|
|
3665
|
-
nav3Url: "#du-an",
|
|
3666
|
-
nav4Label: "C\u1EA9m nang",
|
|
3667
|
-
nav4Url: "#cam-nang",
|
|
3680
|
+
navigation: JSON.stringify(footerNavigationDefaults),
|
|
3668
3681
|
office: "Th\u1EA3o \u0110i\u1EC1n, Th\xE0nh ph\u1ED1 H\u1ED3 Ch\xED Minh\nH\xE0 N\u1ED9i, Vi\u1EC7t Nam",
|
|
3669
3682
|
phone: "+84 28 7300 2288",
|
|
3670
3683
|
copyright: "\xA9 2026 Wikex Estates. B\u1EA3o l\u01B0u m\u1ECDi quy\u1EC1n."
|
|
3671
3684
|
};
|
|
3672
3685
|
function EstateFooterRenderer(props) {
|
|
3686
|
+
const legacyNavigation = [1, 2, 3, 4].map((index) => ({
|
|
3687
|
+
label: String(value4(props.content, `nav${index}Label`, footerNavigationItems[index - 1]?.label ?? "")),
|
|
3688
|
+
url: String(value4(props.content, `nav${index}Url`, footerNavigationItems[index - 1]?.url ?? "#")),
|
|
3689
|
+
urlEnabled: String(value4(props.content, `nav${index}UrlEnabled`, "true"))
|
|
3690
|
+
}));
|
|
3691
|
+
const hasLegacyNavigation = Object.keys(props.content).some((key) => /^nav\d+(Label|Url)(Enabled)?$/.test(key));
|
|
3692
|
+
const rawNavigation = props.content.navigation;
|
|
3693
|
+
const flatNavigation = cmsListItems(props.content, legacyNavigation);
|
|
3694
|
+
const navigationGroups = typeof props.content.items === "string" && rawNavigation === footerDefaults.navigation ? [{ title: "KH\xC1M PH\xC1", items: JSON.stringify(flatNavigation) }] : hasLegacyNavigation && rawNavigation === footerDefaults.navigation ? [{ title: "KH\xC1M PH\xC1", items: JSON.stringify(legacyNavigation) }] : cmsListItems(props.content, footerNavigationDefaults, "navigation");
|
|
3673
3695
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_Box5.default, { component: "footer", sx: { ...estateResponsiveSx, px: { xs: 2, md: 4 }, bgcolor: palette.dark, color: "#F3EFE6" }, children: [
|
|
3674
3696
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_Box5.default, { className: "estate-container", sx: { maxWidth: 1376, mx: "auto", py: { xs: 8, md: 12 } }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_Box5.default, { className: "estate-split", sx: { display: "grid", gap: { xs: 6, md: 8 }, gridTemplateColumns: { xs: "1fr", md: "1.3fr .7fr" } }, children: [
|
|
3675
3697
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_Stack3.default, { alignItems: "flex-start", spacing: 3, children: [
|
|
@@ -3680,11 +3702,17 @@ function EstateFooterRenderer(props) {
|
|
|
3680
3702
|
" \u2197"
|
|
3681
3703
|
] }) }) })
|
|
3682
3704
|
] }),
|
|
3683
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_Box5.default, { className: "estate-footer-links", sx: { display: "grid", gap: 4, gridTemplateColumns: "
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3705
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_Box5.default, { className: "estate-footer-links", sx: { display: "grid", gap: 4, gridTemplateColumns: "repeat(auto-fit, minmax(120px, 1fr))" }, children: [
|
|
3706
|
+
navigationGroups.map((group, groupIndex) => {
|
|
3707
|
+
const navigation = cmsListItems(group, footerNavigationItems);
|
|
3708
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_Stack3.default, { "data-cms-list-field": "navigation", "data-cms-list-item-index": groupIndex, component: "nav", alignItems: "flex-start", spacing: 1.2, children: [
|
|
3709
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_Box5.default, { sx: { mb: 1, color: "#D7BD8A", fontSize: 10, fontWeight: 800, letterSpacing: ".2em" }, children: group.title }),
|
|
3710
|
+
navigation.map((item, itemIndex) => {
|
|
3711
|
+
const navigable = cmsListItemLinkEnabled(item, "url") && !props.editable;
|
|
3712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_Button5.default, { "data-cms-list-field": "items", "data-cms-list-item-index": itemIndex, component: navigable ? "a" : "div", href: navigable ? item.url || "#" : void 0, "aria-disabled": !navigable, sx: { minWidth: 0, p: 0, color: "rgba(255,255,255,.66)", fontSize: 13, textTransform: "none", "&:hover": { bgcolor: "transparent", color: "#D7BD8A" } }, children: item.label }, itemIndex);
|
|
3713
|
+
})
|
|
3714
|
+
] }, groupIndex);
|
|
3715
|
+
}),
|
|
3688
3716
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_Stack3.default, { spacing: 1.2, children: [
|
|
3689
3717
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_Box5.default, { sx: { mb: 1, color: "#D7BD8A", fontSize: 10, fontWeight: 800, letterSpacing: ".2em" }, children: "V\u0102N PH\xD2NG" }),
|
|
3690
3718
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { props, field: "office", fallback: footerDefaults.office, children: (node) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_Box5.default, { sx: { whiteSpace: "pre-line", color: "rgba(255,255,255,.66)", fontSize: 13, lineHeight: 1.7 }, children: node }) }),
|
|
@@ -3700,7 +3728,13 @@ var estateFooterBlock = {
|
|
|
3700
3728
|
imageField("logo", "Logo th\u01B0\u01A1ng hi\u1EC7u"),
|
|
3701
3729
|
paragraphField("statement", "Th\xF4ng \u0111i\u1EC7p"),
|
|
3702
3730
|
textField("email", "Email"),
|
|
3703
|
-
|
|
3731
|
+
{ key: "navigation", label: "Nh\xF3m \u0111i\u1EC1u h\u01B0\u1EDBng", type: "list", group: "\u0110i\u1EC1u h\u01B0\u1EDBng", itemFields: [
|
|
3732
|
+
{ key: "title", label: "Ti\xEAu \u0111\u1EC1", type: "text", required: true },
|
|
3733
|
+
{ key: "items", label: "C\xE1c li\xEAn k\u1EBFt", type: "list", itemFields: [
|
|
3734
|
+
{ key: "label", label: "Nh\xE3n menu", type: "text", required: true },
|
|
3735
|
+
{ key: "url", label: "\u0110\u01B0\u1EDDng d\u1EABn", type: "link" }
|
|
3736
|
+
] }
|
|
3737
|
+
] },
|
|
3704
3738
|
paragraphField("office", "V\u0103n ph\xF2ng"),
|
|
3705
3739
|
textField("phone", "\u0110i\u1EC7n tho\u1EA1i"),
|
|
3706
3740
|
textField("copyright", "B\u1EA3n quy\u1EC1n")
|
|
@@ -4716,6 +4750,7 @@ function restoreEmptyItems(items, templates, itemFields) {
|
|
|
4716
4750
|
});
|
|
4717
4751
|
}
|
|
4718
4752
|
var configs = [
|
|
4753
|
+
listConfig("estate-header", 4, /^nav\d+(Label|Url)$/, fields2(["label", "Nh\xE3n menu", "text"], ["url", "\u0110\u01B0\u1EDDng d\u1EABn", "link"]), "nav", ["label", "url"]),
|
|
4719
4754
|
listConfig("faq", 4, /^(question|answer)\d+$/, fields2(["question", "C\xE2u h\u1ECFi", "text"], ["answer", "Tr\u1EA3 l\u1EDDi", "textarea"]), "", ["question", "answer"]),
|
|
4720
4755
|
listConfig("testimonials", 3, /^(quote|author|role)\d+$/, fields2(["quote", "C\u1EA3m nh\u1EADn", "textarea"], ["author", "Kh\xE1ch h\xE0ng", "text"], ["role", "Ch\u1EE9c danh", "text"]), "", ["quote", "author", "role"]),
|
|
4721
4756
|
listConfig("amenities", 6, /^amenity\d+(Title|Description)$/, fields2(["title", "T\xEAn ti\u1EC7n \xEDch", "text"], ["description", "M\xF4 t\u1EA3", "textarea"]), "amenity", ["title", "description"]),
|
|
@@ -4735,8 +4770,12 @@ var configs = [
|
|
|
4735
4770
|
];
|
|
4736
4771
|
function DynamicListRenderer({ base, config, ...props }) {
|
|
4737
4772
|
const itemTemplates = config.legacy(base.definition.defaults);
|
|
4773
|
+
const legacyItems = config.legacy({ ...base.definition.defaults, ...props.content });
|
|
4774
|
+
const rawItems = props.content.items;
|
|
4775
|
+
const hasLegacyFields = Object.keys(props.content).some((key) => config.fixedField.test(key));
|
|
4776
|
+
const useLegacyItems = hasLegacyFields && (typeof rawItems !== "string" || rawItems === JSON.stringify(itemTemplates));
|
|
4738
4777
|
const items = restoreEmptyItems(
|
|
4739
|
-
cmsListItems(props.content,
|
|
4778
|
+
useLegacyItems ? legacyItems : cmsListItems(props.content, legacyItems),
|
|
4740
4779
|
itemTemplates,
|
|
4741
4780
|
config.fields
|
|
4742
4781
|
);
|