@mercurjs/admin 2.0.0-canary.52 → 2.0.0-canary.53

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.
Files changed (2) hide show
  1. package/dist/index.js +10 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1620,12 +1620,6 @@ var NavItem = ({
1620
1620
  useEffect7(() => {
1621
1621
  setOpen(getIsOpen(to, items, pathname));
1622
1622
  }, [pathname, to, items]);
1623
- const isNestedActive = useCallback5(
1624
- (nestedTo) => {
1625
- return pathname === nestedTo || pathname.startsWith(nestedTo + "/");
1626
- },
1627
- [pathname]
1628
- );
1629
1623
  const navLinkClassNames = useCallback5(
1630
1624
  ({
1631
1625
  to: to2,
@@ -1634,13 +1628,14 @@ var NavItem = ({
1634
1628
  isSetting: isSetting2 = false
1635
1629
  }) => {
1636
1630
  if (["core", "setting"].includes(type)) {
1637
- if (isNested) {
1638
- isActive = isNestedActive(to2);
1639
- } else if (items?.length) {
1640
- const nestedMatch = items.some((item) => isNestedActive(item.to));
1641
- isActive = pathname.startsWith(to2) && !nestedMatch;
1642
- } else {
1643
- isActive = pathname.startsWith(to2);
1631
+ isActive = pathname.startsWith(to2);
1632
+ if (isActive && !isNested && items?.length) {
1633
+ const nestedIsActive = items.some(
1634
+ (item) => pathname.startsWith(item.to)
1635
+ );
1636
+ if (nestedIsActive) {
1637
+ isActive = false;
1638
+ }
1644
1639
  }
1645
1640
  }
1646
1641
  return clx2(BASE_NAV_LINK_CLASSES, {
@@ -1649,7 +1644,7 @@ var NavItem = ({
1649
1644
  [SETTING_NAV_LINK_CLASSES]: isSetting2
1650
1645
  });
1651
1646
  },
1652
- [type, pathname, items, isNestedActive]
1647
+ [type, pathname, items]
1653
1648
  );
1654
1649
  const isSetting = type === "setting";
1655
1650
  return /* @__PURE__ */ jsxs3(
@@ -2730,7 +2725,7 @@ var MainSidebar = () => {
2730
2725
  const customRoutesWithNested = customMenuItems.sort((a, b) => (a.rank ?? 0) - (b.rank ?? 0)).map((item) => ({
2731
2726
  label: item.label,
2732
2727
  to: item.path,
2733
- icon: item.icon ? void 0 : void 0,
2728
+ icon: item.icon ? /* @__PURE__ */ jsx12(item.icon, {}) : void 0,
2734
2729
  translationNs: item.translationNs,
2735
2730
  items: addNestedItems(item.path)
2736
2731
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mercurjs/admin",
3
- "version": "2.0.0-canary.52",
3
+ "version": "2.0.0-canary.53",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/mercurjs/mercur",