@orsetra/shared-ui 1.7.3 → 1.7.4
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.
|
@@ -96,14 +96,14 @@ export function MainSidebar({
|
|
|
96
96
|
|
|
97
97
|
<div className={cn(
|
|
98
98
|
"fixed left-0 top-0 h-full bg-white border-r border-ui-border z-50 transform transition-all duration-300 ease-in-out overflow-y-auto",
|
|
99
|
-
isMinimized ? "w-16" : "w-64 shadow-xl",
|
|
99
|
+
isMinimized ? "w-16" : "w-56 lg:w-60 xl:w-64 shadow-xl",
|
|
100
100
|
isMinimized
|
|
101
101
|
? "translate-x-0"
|
|
102
102
|
: (isOpen ? "translate-x-0" : "-translate-x-full")
|
|
103
103
|
)}>
|
|
104
104
|
<div className={cn(
|
|
105
|
-
"flex items-center h-
|
|
106
|
-
isMinimized ? "justify-center px-2" : "justify-between px-4"
|
|
105
|
+
"flex items-center h-14 border-b border-ui-border bg-white sticky top-0 z-10",
|
|
106
|
+
isMinimized ? "justify-center px-2" : "justify-between px-3 lg:px-4"
|
|
107
107
|
)}>
|
|
108
108
|
{!isMinimized && <Logo className="text-2xl font-semibold text-text-primary" href={main_base_url} />}
|
|
109
109
|
{isMinimized ? (
|
|
@@ -120,7 +120,7 @@ export function MainSidebar({
|
|
|
120
120
|
)}
|
|
121
121
|
</div>
|
|
122
122
|
|
|
123
|
-
<nav className={cn("space-y-1", isMinimized ? "p-2" : "p-3")}>
|
|
123
|
+
<nav className={cn("space-y-0.5 lg:space-y-1", isMinimized ? "p-2" : "p-2 lg:p-3")}>
|
|
124
124
|
{mainMenuItems.map((item) => {
|
|
125
125
|
const Icon = item.icon
|
|
126
126
|
const hasSubMenu = (sidebarMenus[item.id]?.length ?? 0) > 0
|
|
@@ -135,7 +135,7 @@ export function MainSidebar({
|
|
|
135
135
|
|
|
136
136
|
const itemClassName = cn(
|
|
137
137
|
"w-full flex items-center text-left transition-all duration-150 font-medium",
|
|
138
|
-
isMinimized ? "justify-center p-3" : "gap-3 px-3 py-2",
|
|
138
|
+
isMinimized ? "justify-center p-2 lg:p-3" : "gap-2 lg:gap-3 px-2 lg:px-3 py-1.5 lg:py-2",
|
|
139
139
|
isActive
|
|
140
140
|
? "bg-interactive/10 text-interactive border-l-4 border-interactive"
|
|
141
141
|
: "text-text-primary hover:bg-ui-background border-l-4 border-transparent"
|
|
@@ -182,13 +182,13 @@ export function MainSidebar({
|
|
|
182
182
|
|
|
183
183
|
{/* Inline accordion sub-items */}
|
|
184
184
|
{!isMinimized && isExpanded && hasSubMenu && (
|
|
185
|
-
<div className="pl-4 pb-1">
|
|
185
|
+
<div className="pl-3 lg:pl-4 pb-1">
|
|
186
186
|
{sidebarMenus[item.id].map((subItem) => (
|
|
187
187
|
<a
|
|
188
188
|
key={subItem.id}
|
|
189
189
|
href={buildSubItemHref(item.id, subItem.href)}
|
|
190
190
|
onClick={(e) => handleSubMenuClick(e, item.id, subItem.href)}
|
|
191
|
-
className="flex items-center gap-3 px-3 py-2 text-sm text-text-secondary hover:bg-ui-background hover:text-text-primary transition-colors no-underline border-l-2 border-ui-border hover:border-interactive"
|
|
191
|
+
className="flex items-center gap-2 lg:gap-3 px-2 lg:px-3 py-1.5 lg:py-2 text-sm text-text-secondary hover:bg-ui-background hover:text-text-primary transition-colors no-underline border-l-2 border-ui-border hover:border-interactive"
|
|
192
192
|
>
|
|
193
193
|
<subItem.icon className="h-4 w-4 flex-shrink-0 text-text-secondary" />
|
|
194
194
|
{subItem.name}
|
|
@@ -69,8 +69,6 @@ export function useInjectSidebarNavigation(items: SubMenuItem[] | undefined, tit
|
|
|
69
69
|
// ── Sidebar storage ───────────────────────────────────────────────────────────
|
|
70
70
|
|
|
71
71
|
const SIDEBAR_STORAGE_KEY = "sidebar:state"
|
|
72
|
-
const SIDEBAR_WIDTH = "14rem"
|
|
73
|
-
const SIDEBAR_WIDTH_ICON = "3rem"
|
|
74
72
|
const SIDEBAR_KEYBOARD_SHORTCUT = "b"
|
|
75
73
|
|
|
76
74
|
type SidebarContext = {
|
|
@@ -200,13 +198,7 @@ const SidebarProvider = React.forwardRef<
|
|
|
200
198
|
<SidebarContext.Provider value={contextValue}>
|
|
201
199
|
<TooltipProvider delayDuration={0}>
|
|
202
200
|
<div
|
|
203
|
-
style={
|
|
204
|
-
{
|
|
205
|
-
"--sidebar-width": SIDEBAR_WIDTH,
|
|
206
|
-
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
207
|
-
...style,
|
|
208
|
-
} as React.CSSProperties
|
|
209
|
-
}
|
|
201
|
+
style={style ? (style as React.CSSProperties) : undefined}
|
|
210
202
|
suppressHydrationWarning
|
|
211
203
|
className={cn(
|
|
212
204
|
"group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",
|
|
@@ -300,12 +292,12 @@ function Sidebar({ currentMenu, onMainMenuToggle, sidebarMenus = {}, main_base_u
|
|
|
300
292
|
{/* Section label — hidden when collapsed */}
|
|
301
293
|
{!isCollapsed && (
|
|
302
294
|
injectedItems === undefined ? (
|
|
303
|
-
<div className="h-10 flex items-center px-4 flex-shrink-0 gap-2 border-r border-ui-border">
|
|
295
|
+
<div className="h-8 lg:h-10 flex items-center px-3 lg:px-4 flex-shrink-0 gap-2 border-r border-ui-border">
|
|
304
296
|
<div className="h-4 w-4 bg-gray-200 animate-pulse rounded flex-shrink-0" />
|
|
305
297
|
<div className="h-2.5 w-20 bg-gray-200 animate-pulse rounded" />
|
|
306
298
|
</div>
|
|
307
299
|
) : (injectedTitle || (currentMenu && sectionLabels[currentMenu])) ? (
|
|
308
|
-
<div className="h-10 flex items-center px-4 flex-shrink-0 gap-2 border-r border-ui-border">
|
|
300
|
+
<div className="h-8 lg:h-10 flex items-center px-3 lg:px-4 flex-shrink-0 gap-2 border-r border-ui-border">
|
|
309
301
|
{isInjecting ? (
|
|
310
302
|
<button
|
|
311
303
|
type="button"
|
|
@@ -335,7 +327,7 @@ function Sidebar({ currentMenu, onMainMenuToggle, sidebarMenus = {}, main_base_u
|
|
|
335
327
|
{/* Nav */}
|
|
336
328
|
<nav className={cn(
|
|
337
329
|
"flex-1 overflow-y-auto border-r border-ui-border",
|
|
338
|
-
isCollapsed ? "px-1 py-3 space-y-0.5" : "px-3 py-4 space-y-1"
|
|
330
|
+
isCollapsed ? "px-1 py-2 lg:py-3 space-y-0.5" : "px-2 lg:px-3 py-3 lg:py-4 space-y-0.5 lg:space-y-1"
|
|
339
331
|
)}>
|
|
340
332
|
{/* Secondary nav items — skeleton while injected but loading */}
|
|
341
333
|
{injectedItems === undefined ? (
|
|
@@ -344,7 +336,7 @@ function Sidebar({ currentMenu, onMainMenuToggle, sidebarMenus = {}, main_base_u
|
|
|
344
336
|
key={i}
|
|
345
337
|
className={cn(
|
|
346
338
|
"flex items-center border-l-4 border-transparent animate-pulse",
|
|
347
|
-
isCollapsed ? "p-2 justify-center" : "px-3 py-2 gap-x-3"
|
|
339
|
+
isCollapsed ? "p-2 justify-center" : "px-2 lg:px-3 py-1.5 lg:py-2 gap-x-3"
|
|
348
340
|
)}
|
|
349
341
|
>
|
|
350
342
|
<div className="h-4 w-4 bg-gray-200 flex-shrink-0" />
|
|
@@ -375,7 +367,7 @@ function Sidebar({ currentMenu, onMainMenuToggle, sidebarMenus = {}, main_base_u
|
|
|
375
367
|
onClick={handleClick}
|
|
376
368
|
className={cn(
|
|
377
369
|
"flex items-center transition-colors border-l-4",
|
|
378
|
-
isCollapsed ? "justify-center p-2" : "px-3 py-2 gap-x-3 text-sm",
|
|
370
|
+
isCollapsed ? "justify-center p-2" : "px-2 lg:px-3 py-1.5 lg:py-2 gap-x-3 text-sm",
|
|
379
371
|
isActive
|
|
380
372
|
? "bg-interactive/10 text-interactive font-medium border-interactive"
|
|
381
373
|
: "text-text-secondary hover:bg-ui-background hover:text-text-primary border-transparent"
|