@appcorp/shadcn 1.0.32 → 1.0.36

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/shadcn",
3
- "version": "1.0.32",
3
+ "version": "1.0.36",
4
4
  "scripts": {
5
5
  "build:next": "next build",
6
6
  "build:storybook": "storybook build -c .storybook -o .out",
@@ -0,0 +1,4 @@
1
+ export declare const transformBreadcrumbs: (string: string) => {
2
+ label: string;
3
+ href: string;
4
+ }[];
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformBreadcrumbs = void 0;
4
+ var transformBreadcrumbs = function (string) {
5
+ var items = string.split("/").filter(Boolean);
6
+ return items.map(function (item) { return ({
7
+ label: item.charAt(0).toUpperCase() + item.slice(1).replace(/-/g, " "),
8
+ href: "#",
9
+ }); });
10
+ };
11
+ exports.transformBreadcrumbs = transformBreadcrumbs;
@@ -0,0 +1,7 @@
1
+ import { DashboardNavItem } from "../data/admin-dashboard";
2
+ /**
3
+ * Updates navItems to set isActive based on current pathname
4
+ * Checks both main nav URLs and subItem URLs for matches
5
+ * Also marks individual subItems as active when their URL matches
6
+ */
7
+ export declare const transformNavItems: (navItems: DashboardNavItem[], pathname: string) => DashboardNavItem[];
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.transformNavItems = void 0;
15
+ /**
16
+ * Updates navItems to set isActive based on current pathname
17
+ * Checks both main nav URLs and subItem URLs for matches
18
+ * Also marks individual subItems as active when their URL matches
19
+ */
20
+ var transformNavItems = function (navItems, pathname) {
21
+ return navItems.map(function (navItem) {
22
+ // Check if main nav item URL matches
23
+ var isMainActive = navItem.url !== "#" && pathname === navItem.url;
24
+ // Transform subItems to mark active ones
25
+ var updatedSubItems = navItem.subItems.map(function (subItem) {
26
+ return __assign(__assign({}, subItem), { isActive: subItem.url !== "#" && pathname === subItem.url });
27
+ });
28
+ // Check if any subItem is active
29
+ var hasActiveSubItem = updatedSubItems.some(function (subItem) { return subItem.isActive; });
30
+ return __assign(__assign({}, navItem), { isActive: isMainActive || hasActiveSubItem, subItems: updatedSubItems });
31
+ });
32
+ };
33
+ exports.transformNavItems = transformNavItems;