@orderly.network/ui-scaffold 2.8.9-alpha.0 → 2.8.10-alpha.0

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 CHANGED
@@ -50,6 +50,7 @@ type MainNavItem = {
50
50
  name: string;
51
51
  label?: string;
52
52
  href: string;
53
+ activeHrefs?: string[];
53
54
  target?: HTMLAttributeAnchorTarget;
54
55
  icon?: string | react__default.ReactElement;
55
56
  activeIcon?: string | react__default.ReactElement;
package/dist/index.d.ts CHANGED
@@ -50,6 +50,7 @@ type MainNavItem = {
50
50
  name: string;
51
51
  label?: string;
52
52
  href: string;
53
+ activeHrefs?: string[];
53
54
  target?: HTMLAttributeAnchorTarget;
54
55
  icon?: string | react__default.ReactElement;
55
56
  activeIcon?: string | react__default.ReactElement;
package/dist/index.js CHANGED
@@ -5271,10 +5271,14 @@ var NavItem2 = (props) => {
5271
5271
  }
5272
5272
  };
5273
5273
  }, [showButtonTooltip]);
5274
- const isActive = React6.useMemo(
5275
- () => currentPath?.[0] === item.href,
5276
- [currentPath, item.href]
5277
- );
5274
+ const isActive = React6.useMemo(() => {
5275
+ const current = currentPath?.[0];
5276
+ if (!current)
5277
+ return false;
5278
+ if (current === item.href)
5279
+ return true;
5280
+ return Array.isArray(item.activeHrefs) && item.activeHrefs.includes(current);
5281
+ }, [currentPath, item.href, item.activeHrefs]);
5278
5282
  const hasSubMenu = Array.isArray(item.children) || typeof item.customSubMenuRender === "function";
5279
5283
  const hasCustomSubMenuRender = typeof item.customSubMenuRender === "function";
5280
5284
  const onClickHandler = React6.useCallback(() => {