@prediktif/ui 0.1.30 → 0.1.31

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
@@ -4781,12 +4781,19 @@ var HeaderTabs = (0, import_react22.memo)(function HeaderTabs2({
4781
4781
  onValueChange,
4782
4782
  children
4783
4783
  }) {
4784
- var _a, _b;
4784
+ var _a, _b, _c, _d, _e;
4785
4785
  const pathname = (0, import_navigation4.usePathname)();
4786
- const matchedItem = pathname ? items.find(
4787
- (item) => item.url === pathname || pathname.endsWith(item.url) || pathname.split("/").includes(item.value)
4786
+ const normalizedPathname = pathname ? pathname.replace(/\/$/, "") : "";
4787
+ const matchedItem = normalizedPathname ? (_c = (_b = (_a = items.find(
4788
+ (item) => item.url.replace(/\/$/, "") === normalizedPathname
4789
+ )) != null ? _a : [...items].filter(
4790
+ (item) => normalizedPathname.startsWith(`${item.url.replace(/\/$/, "")}/`)
4791
+ ).sort((a, b) => b.url.length - a.url.length)[0]) != null ? _b : items.find(
4792
+ (item) => normalizedPathname.split("/").pop() === item.value
4793
+ )) != null ? _c : items.find(
4794
+ (item) => normalizedPathname.endsWith(item.url.replace(/\/$/, ""))
4788
4795
  ) : void 0;
4789
- const activeTab = (_b = value != null ? value : matchedItem == null ? void 0 : matchedItem.value) != null ? _b : (_a = items[0]) == null ? void 0 : _a.value;
4796
+ const activeTab = (_e = value != null ? value : matchedItem == null ? void 0 : matchedItem.value) != null ? _e : (_d = items[0]) == null ? void 0 : _d.value;
4790
4797
  return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(Tabs, { value: activeTab, onValueChange, className: "space-y-4", children: [
4791
4798
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "w-full overflow-x-auto overflow-y-hidden border-b no-scrollbar", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TabsList, { variant: "line", className: "inline-flex w-max justify-start", children: items.map(({ title, value: tabValue, url, icon }) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
4792
4799
  TabsTrigger,
package/dist/index.mjs CHANGED
@@ -4746,12 +4746,19 @@ var HeaderTabs = memo18(function HeaderTabs2({
4746
4746
  onValueChange,
4747
4747
  children
4748
4748
  }) {
4749
- var _a, _b;
4749
+ var _a, _b, _c, _d, _e;
4750
4750
  const pathname = usePathname2();
4751
- const matchedItem = pathname ? items.find(
4752
- (item) => item.url === pathname || pathname.endsWith(item.url) || pathname.split("/").includes(item.value)
4751
+ const normalizedPathname = pathname ? pathname.replace(/\/$/, "") : "";
4752
+ const matchedItem = normalizedPathname ? (_c = (_b = (_a = items.find(
4753
+ (item) => item.url.replace(/\/$/, "") === normalizedPathname
4754
+ )) != null ? _a : [...items].filter(
4755
+ (item) => normalizedPathname.startsWith(`${item.url.replace(/\/$/, "")}/`)
4756
+ ).sort((a, b) => b.url.length - a.url.length)[0]) != null ? _b : items.find(
4757
+ (item) => normalizedPathname.split("/").pop() === item.value
4758
+ )) != null ? _c : items.find(
4759
+ (item) => normalizedPathname.endsWith(item.url.replace(/\/$/, ""))
4753
4760
  ) : void 0;
4754
- const activeTab = (_b = value != null ? value : matchedItem == null ? void 0 : matchedItem.value) != null ? _b : (_a = items[0]) == null ? void 0 : _a.value;
4761
+ const activeTab = (_e = value != null ? value : matchedItem == null ? void 0 : matchedItem.value) != null ? _e : (_d = items[0]) == null ? void 0 : _d.value;
4755
4762
  return /* @__PURE__ */ jsxs35(Tabs, { value: activeTab, onValueChange, className: "space-y-4", children: [
4756
4763
  /* @__PURE__ */ jsx49("div", { className: "w-full overflow-x-auto overflow-y-hidden border-b no-scrollbar", children: /* @__PURE__ */ jsx49(TabsList, { variant: "line", className: "inline-flex w-max justify-start", children: items.map(({ title, value: tabValue, url, icon }) => /* @__PURE__ */ jsxs35(
4757
4764
  TabsTrigger,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prediktif/ui",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",