@orsetra/shared-ui 1.5.4 → 1.5.6

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.
@@ -61,6 +61,7 @@ function LayoutContent({
61
61
  id: item.id,
62
62
  label: item.label,
63
63
  icon: resolveIcon(item.icon),
64
+ href: item.href,
64
65
  }))
65
66
  )
66
67
 
@@ -29,6 +29,7 @@ export interface MainMenuItem {
29
29
  id: string
30
30
  label: string
31
31
  icon: LucideIcon
32
+ href?: string
32
33
  }
33
34
 
34
35
  export interface SubMenuItem {
@@ -58,6 +59,7 @@ export interface ApiMainMenuItem {
58
59
  id: string
59
60
  label: string
60
61
  icon: string
62
+ href?: string
61
63
  }
62
64
 
63
65
  export interface ApiSubMenuItem {
@@ -195,6 +195,12 @@ function Sidebar({ currentMenu, onMainMenuToggle, sidebarMenus = {}, main_base_u
195
195
 
196
196
  const isCollapsed = state === "collapsed"
197
197
 
198
+ const filteredMainItems = React.useMemo(() => {
199
+ if (!isCollapsed || mainMenuItems.length === 0) return []
200
+ const navIds = new Set(currentNavigation.map((n) => n.id))
201
+ return mainMenuItems.filter((item) => !navIds.has(item.id))
202
+ }, [isCollapsed, mainMenuItems, currentNavigation])
203
+
198
204
  return (
199
205
  <div
200
206
  className="h-screen sticky top-0 flex flex-col bg-gray-50 min-w-[var(--sidebar-width-icon)] transition-[width] duration-200 overflow-visible"
@@ -239,24 +245,28 @@ function Sidebar({ currentMenu, onMainMenuToggle, sidebarMenus = {}, main_base_u
239
245
  "flex-1 overflow-y-auto",
240
246
  isCollapsed ? "px-1 py-3 space-y-0.5" : "px-3 py-4 space-y-1"
241
247
  )}>
242
- {/* Main menu items — only shown in collapsed mode, excluding the current secondary menu */}
243
- {isCollapsed && mainMenuItems.length > 0 && (
248
+ {/* Main menu items — only in collapsed mode, above secondary items */}
249
+ {filteredMainItems.length > 0 && (
244
250
  <>
245
- {mainMenuItems.filter((item) => item.id !== currentMenu).map((item) => {
246
- const href = `${main_base_url}/${item.id}`
251
+ {filteredMainItems.map((item) => {
252
+ const rawHref = item.href || `${main_base_url}/${item.id}`
253
+ const href = rawHref.startsWith('http') ? new URL(rawHref).pathname : rawHref
247
254
  const isActive = currentMenu === item.id
248
255
  const linkEl = (
249
256
  <Link
250
257
  key={item.id}
251
- href={href.startsWith('http') ? new URL(href).pathname : href}
258
+ href={href}
252
259
  className={cn(
253
260
  "flex items-center justify-center p-2 transition-colors border-l-4",
254
261
  isActive
255
- ? "bg-interactive/10 text-interactive border-interactive"
256
- : "text-text-secondary hover:bg-ui-background hover:text-text-primary border-transparent"
262
+ ? "bg-interactive/10 border-interactive"
263
+ : "hover:bg-ui-background border-transparent"
257
264
  )}
258
265
  >
259
- <item.icon className={cn("h-4 w-4 flex-shrink-0", isActive ? "text-interactive" : "text-text-secondary")} />
266
+ <item.icon
267
+ className="h-4 w-4 flex-shrink-0"
268
+ style={{ color: isActive ? '#0f62fe' : '#8d8d8d' }}
269
+ />
260
270
  </Link>
261
271
  )
262
272
  return (
@@ -266,7 +276,7 @@ function Sidebar({ currentMenu, onMainMenuToggle, sidebarMenus = {}, main_base_u
266
276
  </Tooltip>
267
277
  )
268
278
  })}
269
- <div className="border-t border-ui-border mx-1 my-1" />
279
+ <div className="border-t border-ui-border mx-1 my-2" />
270
280
  </>
271
281
  )}
272
282
 
@@ -297,7 +307,10 @@ function Sidebar({ currentMenu, onMainMenuToggle, sidebarMenus = {}, main_base_u
297
307
  : "text-text-secondary hover:bg-ui-background hover:text-text-primary border-transparent"
298
308
  )}
299
309
  >
300
- <item.icon className={cn("h-4 w-4 flex-shrink-0", isActive ? "text-interactive" : "text-ibm-blue-50")} />
310
+ <item.icon
311
+ className="h-4 w-4 flex-shrink-0"
312
+ style={{ color: isActive ? '#0f62fe' : '#4589ff' }}
313
+ />
301
314
  {!isCollapsed && item.name}
302
315
  </Link>
303
316
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orsetra/shared-ui",
3
- "version": "1.5.4",
3
+ "version": "1.5.6",
4
4
  "description": "Shared UI components for Orsetra platform",
5
5
  "main": "./index.ts",
6
6
  "types": "./index.ts",