baaz-custom-components 3.2.18 → 3.2.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.js CHANGED
@@ -793,20 +793,20 @@ function getActiveChildGroup(data, base, pathname) {
793
793
  const full = buildFullHref(base, routes);
794
794
  let hrefPath = extractPathname(full);
795
795
  if (hrefPath.endsWith("/-")) hrefPath = hrefPath.slice(0, -2);
796
- if (pathname === hrefPath || pathname.startsWith(hrefPath + "/")) {
796
+ if (pathname.startsWith(hrefPath)) {
797
797
  return null;
798
798
  }
799
- } else if (Array.isArray(routes)) {
799
+ } else {
800
800
  const children = routes;
801
- let firstPath = "";
802
- if (typeof children[0].routes === "string") {
803
- firstPath = children[0].routes;
804
- }
805
- const full = buildFullHref(base, firstPath);
806
- let hrefPath = extractPathname(full);
807
- if (hrefPath.endsWith("/-")) hrefPath = hrefPath.slice(0, -2);
808
- if (pathname.startsWith(hrefPath)) {
809
- if (children.length > 0) {
801
+ const anyChildMatches = children.some((child) => {
802
+ if (typeof child.routes !== "string") return false;
803
+ const full = buildFullHref(base, child.routes);
804
+ let hrefPath = extractPathname(full);
805
+ if (hrefPath.endsWith("/-")) hrefPath = hrefPath.slice(0, -2);
806
+ return pathname.startsWith(hrefPath);
807
+ });
808
+ if (anyChildMatches) {
809
+ if (children.length > 1) {
810
810
  return { base, children };
811
811
  }
812
812
  return null;
package/dist/index.mjs CHANGED
@@ -759,20 +759,20 @@ function getActiveChildGroup(data, base, pathname) {
759
759
  const full = buildFullHref(base, routes);
760
760
  let hrefPath = extractPathname(full);
761
761
  if (hrefPath.endsWith("/-")) hrefPath = hrefPath.slice(0, -2);
762
- if (pathname === hrefPath || pathname.startsWith(hrefPath + "/")) {
762
+ if (pathname.startsWith(hrefPath)) {
763
763
  return null;
764
764
  }
765
- } else if (Array.isArray(routes)) {
765
+ } else {
766
766
  const children = routes;
767
- let firstPath = "";
768
- if (typeof children[0].routes === "string") {
769
- firstPath = children[0].routes;
770
- }
771
- const full = buildFullHref(base, firstPath);
772
- let hrefPath = extractPathname(full);
773
- if (hrefPath.endsWith("/-")) hrefPath = hrefPath.slice(0, -2);
774
- if (pathname.startsWith(hrefPath)) {
775
- if (children.length > 0) {
767
+ const anyChildMatches = children.some((child) => {
768
+ if (typeof child.routes !== "string") return false;
769
+ const full = buildFullHref(base, child.routes);
770
+ let hrefPath = extractPathname(full);
771
+ if (hrefPath.endsWith("/-")) hrefPath = hrefPath.slice(0, -2);
772
+ return pathname.startsWith(hrefPath);
773
+ });
774
+ if (anyChildMatches) {
775
+ if (children.length > 1) {
776
776
  return { base, children };
777
777
  }
778
778
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baaz-custom-components",
3
- "version": "3.2.18",
3
+ "version": "3.2.19",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.js",