@orsetra/shared-ui 1.0.15 → 1.0.16

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.
@@ -20,6 +20,8 @@ export interface SubMenuItem {
20
20
  name: string
21
21
  href: string
22
22
  icon: LucideIcon
23
+ /** Fonction optionnelle pour transformer le href avant navigation */
24
+ hrefTransform?: (href: string) => string
23
25
  }
24
26
 
25
27
  export interface SidebarMenus {
@@ -220,11 +220,12 @@ function Sidebar({ currentMenu, onMainMenuToggle, sidebarMenus = {} }: SidebarPr
220
220
  {/* Navigation principale avec espacements ajustés */}
221
221
  <nav className="flex-1 px-3 py-4 space-y-1 overflow-y-auto">
222
222
  {currentNavigation.map((item) => {
223
- const isActive = pathname === item.href || pathname.startsWith(`${item.href}/`)
223
+ const finalHref = item.hrefTransform ? item.hrefTransform(item.href) : item.href
224
+ const isActive = pathname === finalHref || pathname.startsWith(`${finalHref}/`)
224
225
  return (
225
226
  <Link
226
227
  key={item.name}
227
- href={item.href}
228
+ href={finalHref}
228
229
  className={cn(
229
230
  "flex items-center px-3 py-2 text-sm rounded-md gap-x-3 transition-colors",
230
231
  isActive
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orsetra/shared-ui",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "Shared UI components for Orsetra platform",
5
5
  "main": "./index.ts",
6
6
  "types": "./index.ts",
@@ -92,4 +92,4 @@
92
92
  "next": "^16.0.7",
93
93
  "typescript": "^5"
94
94
  }
95
- }
95
+ }