@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.mjs CHANGED
@@ -3590,10 +3590,21 @@ var headerDefaults = {
3590
3590
  ctaUrl: "#lien-he"
3591
3591
  };
3592
3592
  function EstateHeaderRenderer(props) {
3593
+ const navigation = cmsListItems(
3594
+ props.content,
3595
+ [1, 2, 3, 4].map((index) => ({
3596
+ label: String(value4(props.content, `nav${index}Label`, headerDefaults[`nav${index}Label`])),
3597
+ url: String(value4(props.content, `nav${index}Url`, headerDefaults[`nav${index}Url`]))
3598
+ }))
3599
+ );
3593
3600
  return /* @__PURE__ */ jsx5(Box5, { 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__ */ jsxs5(Box5, { className: "estate-container", sx: { display: "flex", minHeight: { xs: 76, md: 96 }, maxWidth: 1376, mx: "auto", alignItems: "center", justifyContent: "space-between", gap: 2 }, children: [
3594
3601
  /* @__PURE__ */ jsx5(EstateLogo, { props, fallback: headerDefaults.logo }),
3595
3602
  /* @__PURE__ */ jsxs5(Stack3, { component: "nav", direction: "row", spacing: { md: 3, lg: 4 }, sx: { alignItems: "center", "@container (max-width: 767px)": { display: "none" } }, children: [
3596
- [1, 2, 3, 4].map((index) => /* @__PURE__ */ jsx5(Button5, { component: "a", href: String(value4(props.content, `nav${index}Url`, headerDefaults[`nav${index}Url`])), sx: { minWidth: 0, p: 0, color: "inherit", fontSize: 12, fontWeight: 600, textTransform: "none", "&:hover": { bgcolor: "transparent", opacity: 0.6 } }, children: /* @__PURE__ */ jsx5(Text, { props, field: `nav${index}Label`, fallback: headerDefaults[`nav${index}Label`], children: (node) => node }) }, index)),
3603
+ navigation.map((item, itemIndex) => {
3604
+ const index = itemIndex + 1;
3605
+ const navigable = cmsListItemLinkEnabled(item, "url") && !props.editable;
3606
+ return /* @__PURE__ */ jsx5(Button5, { "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__ */ jsx5(Text, { props, field: `nav${index}Label`, fallback: item.label, children: (node) => node }) }, index);
3607
+ }),
3597
3608
  /* @__PURE__ */ jsx5(Button5, { 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__ */ jsx5(Text, { props, field: "ctaLabel", fallback: headerDefaults.ctaLabel, children: (node) => /* @__PURE__ */ jsxs5(Fragment3, { children: [
3598
3609
  node,
3599
3610
  " \u2197"
@@ -3611,23 +3622,34 @@ var estateHeaderBlock = {
3611
3622
  ), headerDefaults, "header"),
3612
3623
  Renderer: EstateHeaderRenderer
3613
3624
  };
3625
+ var footerNavigationItems = [
3626
+ { label: "V\u1EC1 Wikex Estates", url: "#gioi-thieu", urlEnabled: "true" },
3627
+ { label: "D\u1ECBch v\u1EE5", url: "#dich-vu", urlEnabled: "true" },
3628
+ { label: "D\u1EF1 \xE1n", url: "#du-an", urlEnabled: "true" },
3629
+ { label: "C\u1EA9m nang", url: "#cam-nang", urlEnabled: "true" }
3630
+ ];
3631
+ var footerNavigationDefaults = [
3632
+ { title: "KH\xC1M PH\xC1", items: JSON.stringify(footerNavigationItems) }
3633
+ ];
3614
3634
  var footerDefaults = {
3615
3635
  logo: wikex_estates_logo_default,
3616
3636
  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.",
3617
3637
  email: "hello@wikex.vn",
3618
- nav1Label: "V\u1EC1 Wikex Estates",
3619
- nav1Url: "#gioi-thieu",
3620
- nav2Label: "D\u1ECBch v\u1EE5",
3621
- nav2Url: "#dich-vu",
3622
- nav3Label: "D\u1EF1 \xE1n",
3623
- nav3Url: "#du-an",
3624
- nav4Label: "C\u1EA9m nang",
3625
- nav4Url: "#cam-nang",
3638
+ navigation: JSON.stringify(footerNavigationDefaults),
3626
3639
  office: "Th\u1EA3o \u0110i\u1EC1n, Th\xE0nh ph\u1ED1 H\u1ED3 Ch\xED Minh\nH\xE0 N\u1ED9i, Vi\u1EC7t Nam",
3627
3640
  phone: "+84 28 7300 2288",
3628
3641
  copyright: "\xA9 2026 Wikex Estates. B\u1EA3o l\u01B0u m\u1ECDi quy\u1EC1n."
3629
3642
  };
3630
3643
  function EstateFooterRenderer(props) {
3644
+ const legacyNavigation = [1, 2, 3, 4].map((index) => ({
3645
+ label: String(value4(props.content, `nav${index}Label`, footerNavigationItems[index - 1]?.label ?? "")),
3646
+ url: String(value4(props.content, `nav${index}Url`, footerNavigationItems[index - 1]?.url ?? "#")),
3647
+ urlEnabled: String(value4(props.content, `nav${index}UrlEnabled`, "true"))
3648
+ }));
3649
+ const hasLegacyNavigation = Object.keys(props.content).some((key) => /^nav\d+(Label|Url)(Enabled)?$/.test(key));
3650
+ const rawNavigation = props.content.navigation;
3651
+ const flatNavigation = cmsListItems(props.content, legacyNavigation);
3652
+ 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");
3631
3653
  return /* @__PURE__ */ jsxs5(Box5, { component: "footer", sx: { ...estateResponsiveSx, px: { xs: 2, md: 4 }, bgcolor: palette.dark, color: "#F3EFE6" }, children: [
3632
3654
  /* @__PURE__ */ jsx5(Box5, { className: "estate-container", sx: { maxWidth: 1376, mx: "auto", py: { xs: 8, md: 12 } }, children: /* @__PURE__ */ jsxs5(Box5, { className: "estate-split", sx: { display: "grid", gap: { xs: 6, md: 8 }, gridTemplateColumns: { xs: "1fr", md: "1.3fr .7fr" } }, children: [
3633
3655
  /* @__PURE__ */ jsxs5(Stack3, { alignItems: "flex-start", spacing: 3, children: [
@@ -3638,11 +3660,17 @@ function EstateFooterRenderer(props) {
3638
3660
  " \u2197"
3639
3661
  ] }) }) })
3640
3662
  ] }),
3641
- /* @__PURE__ */ jsxs5(Box5, { className: "estate-footer-links", sx: { display: "grid", gap: 4, gridTemplateColumns: "1fr 1fr" }, children: [
3642
- /* @__PURE__ */ jsxs5(Stack3, { component: "nav", alignItems: "flex-start", spacing: 1.2, children: [
3643
- /* @__PURE__ */ jsx5(Box5, { sx: { mb: 1, color: "#D7BD8A", fontSize: 10, fontWeight: 800, letterSpacing: ".2em" }, children: "KH\xC1M PH\xC1" }),
3644
- [1, 2, 3, 4].map((index) => /* @__PURE__ */ jsx5(Button5, { component: "a", href: String(value4(props.content, `nav${index}Url`, footerDefaults[`nav${index}Url`])), sx: { minWidth: 0, p: 0, color: "rgba(255,255,255,.66)", fontSize: 13, textTransform: "none", "&:hover": { bgcolor: "transparent", color: "#D7BD8A" } }, children: /* @__PURE__ */ jsx5(Text, { props, field: `nav${index}Label`, fallback: footerDefaults[`nav${index}Label`], children: (node) => node }) }, index))
3645
- ] }),
3663
+ /* @__PURE__ */ jsxs5(Box5, { className: "estate-footer-links", sx: { display: "grid", gap: 4, gridTemplateColumns: "repeat(auto-fit, minmax(120px, 1fr))" }, children: [
3664
+ navigationGroups.map((group, groupIndex) => {
3665
+ const navigation = cmsListItems(group, footerNavigationItems);
3666
+ return /* @__PURE__ */ jsxs5(Stack3, { "data-cms-list-field": "navigation", "data-cms-list-item-index": groupIndex, component: "nav", alignItems: "flex-start", spacing: 1.2, children: [
3667
+ /* @__PURE__ */ jsx5(Box5, { sx: { mb: 1, color: "#D7BD8A", fontSize: 10, fontWeight: 800, letterSpacing: ".2em" }, children: group.title }),
3668
+ navigation.map((item, itemIndex) => {
3669
+ const navigable = cmsListItemLinkEnabled(item, "url") && !props.editable;
3670
+ return /* @__PURE__ */ jsx5(Button5, { "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);
3671
+ })
3672
+ ] }, groupIndex);
3673
+ }),
3646
3674
  /* @__PURE__ */ jsxs5(Stack3, { spacing: 1.2, children: [
3647
3675
  /* @__PURE__ */ jsx5(Box5, { sx: { mb: 1, color: "#D7BD8A", fontSize: 10, fontWeight: 800, letterSpacing: ".2em" }, children: "V\u0102N PH\xD2NG" }),
3648
3676
  /* @__PURE__ */ jsx5(Text, { props, field: "office", fallback: footerDefaults.office, children: (node) => /* @__PURE__ */ jsx5(Box5, { sx: { whiteSpace: "pre-line", color: "rgba(255,255,255,.66)", fontSize: 13, lineHeight: 1.7 }, children: node }) }),
@@ -3658,7 +3686,13 @@ var estateFooterBlock = {
3658
3686
  imageField("logo", "Logo th\u01B0\u01A1ng hi\u1EC7u"),
3659
3687
  paragraphField("statement", "Th\xF4ng \u0111i\u1EC7p"),
3660
3688
  textField("email", "Email"),
3661
- ...[1, 2, 3, 4].flatMap((index) => [textField(`nav${index}Label`, "Nh\xE3n menu", `\u0110i\u1EC1u h\u01B0\u1EDBng ${index}`), textField(`nav${index}Url`, "\u0110\u01B0\u1EDDng d\u1EABn", `\u0110i\u1EC1u h\u01B0\u1EDBng ${index}`)]),
3689
+ { key: "navigation", label: "Nh\xF3m \u0111i\u1EC1u h\u01B0\u1EDBng", type: "list", group: "\u0110i\u1EC1u h\u01B0\u1EDBng", itemFields: [
3690
+ { key: "title", label: "Ti\xEAu \u0111\u1EC1", type: "text", required: true },
3691
+ { key: "items", label: "C\xE1c li\xEAn k\u1EBFt", type: "list", itemFields: [
3692
+ { key: "label", label: "Nh\xE3n menu", type: "text", required: true },
3693
+ { key: "url", label: "\u0110\u01B0\u1EDDng d\u1EABn", type: "link" }
3694
+ ] }
3695
+ ] },
3662
3696
  paragraphField("office", "V\u0103n ph\xF2ng"),
3663
3697
  textField("phone", "\u0110i\u1EC7n tho\u1EA1i"),
3664
3698
  textField("copyright", "B\u1EA3n quy\u1EC1n")
@@ -4674,6 +4708,7 @@ function restoreEmptyItems(items, templates, itemFields) {
4674
4708
  });
4675
4709
  }
4676
4710
  var configs = [
4711
+ listConfig("estate-header", 4, /^nav\d+(Label|Url)$/, fields2(["label", "Nh\xE3n menu", "text"], ["url", "\u0110\u01B0\u1EDDng d\u1EABn", "link"]), "nav", ["label", "url"]),
4677
4712
  listConfig("faq", 4, /^(question|answer)\d+$/, fields2(["question", "C\xE2u h\u1ECFi", "text"], ["answer", "Tr\u1EA3 l\u1EDDi", "textarea"]), "", ["question", "answer"]),
4678
4713
  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"]),
4679
4714
  listConfig("amenities", 6, /^amenity\d+(Title|Description)$/, fields2(["title", "T\xEAn ti\u1EC7n \xEDch", "text"], ["description", "M\xF4 t\u1EA3", "textarea"]), "amenity", ["title", "description"]),
@@ -4693,8 +4728,12 @@ var configs = [
4693
4728
  ];
4694
4729
  function DynamicListRenderer({ base, config, ...props }) {
4695
4730
  const itemTemplates = config.legacy(base.definition.defaults);
4731
+ const legacyItems = config.legacy({ ...base.definition.defaults, ...props.content });
4732
+ const rawItems = props.content.items;
4733
+ const hasLegacyFields = Object.keys(props.content).some((key) => config.fixedField.test(key));
4734
+ const useLegacyItems = hasLegacyFields && (typeof rawItems !== "string" || rawItems === JSON.stringify(itemTemplates));
4696
4735
  const items = restoreEmptyItems(
4697
- cmsListItems(props.content, config.legacy(props.content)),
4736
+ useLegacyItems ? legacyItems : cmsListItems(props.content, legacyItems),
4698
4737
  itemTemplates,
4699
4738
  config.fields
4700
4739
  );