fix(ui): render only supplied mega menu metadata
Quality / quality (windows-latest) (push) Waiting to run
Quality / quality (ubuntu-latest) (push) Failing after 9m55s

This commit is contained in:
2026-08-24 22:57:13 +05:30
parent eca4447dcf
commit 8f3a13c854
5 changed files with 7 additions and 22 deletions
+1 -1
View File
@@ -688,7 +688,7 @@
}, },
"packages/ui": { "packages/ui": {
"name": "@wrnexus/ui", "name": "@wrnexus/ui",
"version": "0.8.36", "version": "0.8.37",
"dependencies": { "dependencies": {
"@wrnexus/core": "workspace:*", "@wrnexus/core": "workspace:*",
}, },
+1 -1
View File
@@ -55,7 +55,7 @@
"packages/ui/components/Map.wrn": "3e6d5de5a21dd050c5c65950d6fb2f89af4024e1856a48f055b65b88fcd7b890", "packages/ui/components/Map.wrn": "3e6d5de5a21dd050c5c65950d6fb2f89af4024e1856a48f055b65b88fcd7b890",
"packages/ui/components/MarketingSectionHeader.wrn": "39b79499b77dc1c7d34e4e5ecb45a9ddc6182f78c2a2586671c4fa07f44679ad", "packages/ui/components/MarketingSectionHeader.wrn": "39b79499b77dc1c7d34e4e5ecb45a9ddc6182f78c2a2586671c4fa07f44679ad",
"packages/ui/components/Marquee.wrn": "81cd80732be34c8d7e4bf28b00347e1a9273166afdf66589d9f5d5774b69403b", "packages/ui/components/Marquee.wrn": "81cd80732be34c8d7e4bf28b00347e1a9273166afdf66589d9f5d5774b69403b",
"packages/ui/components/MegaMenu.wrn": "c0bcd0613dba0237b211c4d0f2beb26616e4e1468715ad60965a31922860fcce", "packages/ui/components/MegaMenu.wrn": "1726a935b963b4a7ad9420b24e1ba6ad6de979709fa552e4717fb67e79c4de42",
"packages/ui/components/MetricCard.wrn": "513a6e99be3d9db46d96af9942b51331a0a048b184603e77e814506f0a52bdc5", "packages/ui/components/MetricCard.wrn": "513a6e99be3d9db46d96af9942b51331a0a048b184603e77e814506f0a52bdc5",
"packages/ui/components/MetricGrid.wrn": "1fcebf51dcbe8520fe16bda904c1ef206c25c3900438d53877492c64ea21a1a5", "packages/ui/components/MetricGrid.wrn": "1fcebf51dcbe8520fe16bda904c1ef206c25c3900438d53877492c64ea21a1a5",
"packages/ui/components/Modal.wrn": "7fa4b877772736f29f690e24d8742922b310397ef3083f0b78acb67a9f0d14b2", "packages/ui/components/Modal.wrn": "7fa4b877772736f29f690e24d8742922b310397ef3083f0b78acb67a9f0d14b2",
+2 -19
View File
@@ -58,23 +58,6 @@ component MegaMenu {
return column && Array.isArray(column.items) ? column.items : [] return column && Array.isArray(column.items) ? column.items : []
} }
shared function itemIcon(item) {
if (item && item.icon) {
return item.icon
}
return variant === "catalog" ? "icon-[lucide--component]" : ""
}
shared function itemDescription(item, column) {
if (item && item.description) {
return item.description
}
if (variant === "catalog" && item && item.label) {
return "Open " + item.label + (column && column.heading ? " in " + column.heading : "")
}
return ""
}
shared function railList() { shared function railList() {
return Array.isArray(rail) ? rail : [] return Array.isArray(rail) ? rail : []
} }
@@ -259,11 +242,11 @@ component MegaMenu {
<li> <li>
<a class="wrn-mega__link" href='{item.href || "#"}' data-wrn-roving-item="true" aria-disabled='{item.disabled ? "true" : "false"}' @click='choose(item)'> <a class="wrn-mega__link" href='{item.href || "#"}' data-wrn-roving-item="true" aria-disabled='{item.disabled ? "true" : "false"}' @click='choose(item)'>
{#if item.image}<img class="wrn-mega__link-image" src='{item.image}' alt="" loading="lazy" />{/if} {#if item.image}<img class="wrn-mega__link-image" src='{item.image}' alt="" loading="lazy" />{/if}
<span class='wrn-mega__link-icon {itemIcon(item)}' data-show="itemIcon(item)" aria-hidden="true"></span> {#if item.icon}<span class='wrn-mega__link-icon {item.icon}' aria-hidden="true"></span>{/if}
<span class="wrn-mega__link-body"> <span class="wrn-mega__link-body">
{#if item.eyebrow}<span class="wrn-mega__link-eyebrow">{item.eyebrow}</span>{/if} {#if item.eyebrow}<span class="wrn-mega__link-eyebrow">{item.eyebrow}</span>{/if}
<span class="wrn-mega__link-label">{item.label}{#if item.badge}<span class="wrn-mega__badge">{item.badge}</span>{/if}</span> <span class="wrn-mega__link-label">{item.label}{#if item.badge}<span class="wrn-mega__badge">{item.badge}</span>{/if}</span>
<span class="wrn-mega__link-description" data-show="itemDescription(item, column)">{itemDescription(item, column)}</span> {#if item.description}<span class="wrn-mega__link-description">{item.description}</span>{/if}
</span> </span>
</a> </a>
</li> </li>
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@wrnexus/ui", "name": "@wrnexus/ui",
"version": "0.8.36", "version": "0.8.37",
"private": true, "private": true,
"type": "module", "type": "module",
"main": "src/index.ts", "main": "src/index.ts",
+2
View File
@@ -2972,6 +2972,8 @@ test("catalog mega menu renders only the active rail category", async () => {
expect(source).toContain("overflow-y: auto"); expect(source).toContain("overflow-y: auto");
expect(source).not.toContain("@mouseenter='chooseCategory(item, index)'"); expect(source).not.toContain("@mouseenter='chooseCategory(item, index)'");
expect(dom.querySelector(".wrn-mega__column-header")?.textContent).toContain("Sales"); expect(dom.querySelector(".wrn-mega__column-header")?.textContent).toContain("Sales");
expect(dom.querySelectorAll(".wrn-mega__link-icon")).toHaveLength(0);
expect(dom.querySelectorAll(".wrn-mega__link-description")).toHaveLength(0);
}); });
test("mega menu supports rails, icons, badges, media, featured content and footer actions", async () => { test("mega menu supports rails, icons, badges, media, featured content and footer actions", async () => {