baaz-custom-components 3.2.18 → 3.2.20

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;
@@ -914,7 +914,7 @@ var Notifications = ({
914
914
  {
915
915
  className: "w-80 h-96 bg-card-foreground",
916
916
  align: "start",
917
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ScrollArea, { className: "w-full h-full", children: (notificationData == null ? void 0 : notificationData.length) == 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h1", { className: "text-center flex items-center justify-center h-80 w-full", children: "No Notifications" }) : notificationData == null ? void 0 : notificationData.map((data, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
917
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ScrollArea, { className: "w-full h-full", children: (notificationData == null ? void 0 : notificationData.length) == 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h1", { className: "text-center flex items-center h-80 w-full", children: "No Notifications" }) : notificationData == null ? void 0 : notificationData.map((data, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
918
918
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex py-4 px-5 gap-6", children: [
919
919
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "w-3 h-3 mt-2 bg-accent rounded-full flex-shrink-0" }),
920
920
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: " flex gap-2 flex-col text-sm", children: [
@@ -947,7 +947,7 @@ function SubNav({
947
947
  setPath(router.pathname);
948
948
  }, [router.pathname]);
949
949
  if (!childrenRoutes || childrenRoutes.length === 0) return null;
950
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "bg-transparent w-full px-8 py-2", children: childrenRoutes.map((child) => {
950
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "bg-transparent w-full px-8 py-2 flex items-center justify-center gap-4", children: childrenRoutes.map((child) => {
951
951
  if (typeof child.routes !== "string") return null;
952
952
  const href = buildFullHref(base, child.routes);
953
953
  const active = isRouteActive(href, path);
@@ -956,7 +956,7 @@ function SubNav({
956
956
  {
957
957
  onClick: () => router.push(href),
958
958
  className: cn(
959
- "px-3 py-1 text-sm rounded-md whitespace-nowrap cursor-pointer border-b-2 mx-2",
959
+ "px-3 py-1 text-sm rounded-md whitespace-nowrap cursor-pointer border-b-2 ",
960
960
  active ? "bg-accent text-accent-foreground" : "text-muted-foreground hover:bg-primary"
961
961
  ),
962
962
  children: child.label
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;
@@ -880,7 +880,7 @@ var Notifications = ({
880
880
  {
881
881
  className: "w-80 h-96 bg-card-foreground",
882
882
  align: "start",
883
- children: /* @__PURE__ */ jsx10(ScrollArea, { className: "w-full h-full", children: (notificationData == null ? void 0 : notificationData.length) == 0 ? /* @__PURE__ */ jsx10("h1", { className: "text-center flex items-center justify-center h-80 w-full", children: "No Notifications" }) : notificationData == null ? void 0 : notificationData.map((data, index) => /* @__PURE__ */ jsxs8("div", { children: [
883
+ children: /* @__PURE__ */ jsx10(ScrollArea, { className: "w-full h-full", children: (notificationData == null ? void 0 : notificationData.length) == 0 ? /* @__PURE__ */ jsx10("h1", { className: "text-center flex items-center h-80 w-full", children: "No Notifications" }) : notificationData == null ? void 0 : notificationData.map((data, index) => /* @__PURE__ */ jsxs8("div", { children: [
884
884
  /* @__PURE__ */ jsxs8("div", { className: "flex py-4 px-5 gap-6", children: [
885
885
  /* @__PURE__ */ jsx10("div", { className: "w-3 h-3 mt-2 bg-accent rounded-full flex-shrink-0" }),
886
886
  /* @__PURE__ */ jsxs8("div", { className: " flex gap-2 flex-col text-sm", children: [
@@ -913,7 +913,7 @@ function SubNav({
913
913
  setPath(router.pathname);
914
914
  }, [router.pathname]);
915
915
  if (!childrenRoutes || childrenRoutes.length === 0) return null;
916
- return /* @__PURE__ */ jsx11("div", { className: "bg-transparent w-full px-8 py-2", children: childrenRoutes.map((child) => {
916
+ return /* @__PURE__ */ jsx11("div", { className: "bg-transparent w-full px-8 py-2 flex items-center justify-center gap-4", children: childrenRoutes.map((child) => {
917
917
  if (typeof child.routes !== "string") return null;
918
918
  const href = buildFullHref(base, child.routes);
919
919
  const active = isRouteActive(href, path);
@@ -922,7 +922,7 @@ function SubNav({
922
922
  {
923
923
  onClick: () => router.push(href),
924
924
  className: cn(
925
- "px-3 py-1 text-sm rounded-md whitespace-nowrap cursor-pointer border-b-2 mx-2",
925
+ "px-3 py-1 text-sm rounded-md whitespace-nowrap cursor-pointer border-b-2 ",
926
926
  active ? "bg-accent text-accent-foreground" : "text-muted-foreground hover:bg-primary"
927
927
  ),
928
928
  children: child.label
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.20",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.js",