@mesob/ui 0.4.5 → 0.4.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.
@@ -2861,20 +2861,28 @@ function AppSidebar({
2861
2861
  {
2862
2862
  "aria-label": "Main navigation",
2863
2863
  className: "flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden overflow-y-auto",
2864
- children: Object.entries(groupedItems).map(([groupName, items]) => /* @__PURE__ */ jsxs14(SidebarGroup, { className: "py-0", children: [
2865
- groupName !== "default" && /* @__PURE__ */ jsx21(SidebarGroupLabel, { className: "uppercase tracking-wide", children: groupName }),
2866
- /* @__PURE__ */ jsx21(SidebarGroupContent, { children: /* @__PURE__ */ jsx21("ul", { className: "flex w-full min-w-0 list-none flex-col gap-0 p-0", children: items.map((item, index) => /* @__PURE__ */ jsx21(
2867
- NavItemRow,
2868
- {
2869
- item,
2870
- level: 0,
2871
- pathname,
2872
- userPermissions,
2873
- onNavClick: closeSidebar
2874
- },
2875
- `${groupName}-${index}-${item.href ?? item.title}`
2876
- )) }) })
2877
- ] }, groupName))
2864
+ children: Object.entries(groupedItems).map(([groupName, items]) => {
2865
+ const visibleItems = items.filter(
2866
+ (item) => hasGrant(item.permission, userPermissions)
2867
+ );
2868
+ if (visibleItems.length === 0) {
2869
+ return null;
2870
+ }
2871
+ return /* @__PURE__ */ jsxs14(SidebarGroup, { className: "py-0", children: [
2872
+ groupName !== "default" && /* @__PURE__ */ jsx21(SidebarGroupLabel, { className: "uppercase tracking-wide", children: groupName }),
2873
+ /* @__PURE__ */ jsx21(SidebarGroupContent, { children: /* @__PURE__ */ jsx21("ul", { className: "flex w-full min-w-0 list-none flex-col gap-0 p-0", children: visibleItems.map((item, index) => /* @__PURE__ */ jsx21(
2874
+ NavItemRow,
2875
+ {
2876
+ item,
2877
+ level: 0,
2878
+ pathname,
2879
+ userPermissions,
2880
+ onNavClick: closeSidebar
2881
+ },
2882
+ `${groupName}-${index}-${item.href ?? item.title}`
2883
+ )) }) })
2884
+ ] }, groupName);
2885
+ })
2878
2886
  }
2879
2887
  ) }),
2880
2888
  footer && /* @__PURE__ */ jsx21(SidebarFooter, { children: footer })