@orsetra/shared-ui 1.0.43 → 1.0.45
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,10 +61,11 @@ function LayoutContent({ children, sidebarMenus, user, onSignOut, mode = 'expand
|
|
|
61
61
|
<div className="flex h-screen w-full bg-white">
|
|
62
62
|
{/* Desktop sidebar - hidden on mobile (isHidden is true on mobile) */}
|
|
63
63
|
{!isMinimized && !isHidden && (
|
|
64
|
-
<Sidebar
|
|
64
|
+
<Sidebar
|
|
65
65
|
currentMenu={currentMenu}
|
|
66
66
|
onMainMenuToggle={handleMainSidebarToggle}
|
|
67
67
|
sidebarMenus={sidebarMenus}
|
|
68
|
+
main_base_url={main_base_url}
|
|
68
69
|
/>
|
|
69
70
|
)}
|
|
70
71
|
|
|
@@ -23,7 +23,9 @@ import {
|
|
|
23
23
|
Settings,
|
|
24
24
|
Package,
|
|
25
25
|
Rocket,
|
|
26
|
-
Menu
|
|
26
|
+
Menu,
|
|
27
|
+
Building2,
|
|
28
|
+
User,
|
|
27
29
|
} from "lucide-react"
|
|
28
30
|
import { Logo } from "../../ui/logo"
|
|
29
31
|
import { menuLabels, type SidebarMenus, type SubMenuItem } from "./data"
|
|
@@ -170,22 +172,38 @@ interface SidebarProps {
|
|
|
170
172
|
currentMenu?: string
|
|
171
173
|
onMainMenuToggle?: () => void
|
|
172
174
|
sidebarMenus?: SidebarMenus
|
|
175
|
+
main_base_url?: string
|
|
173
176
|
}
|
|
174
177
|
|
|
175
178
|
|
|
176
179
|
|
|
177
|
-
function Sidebar({ currentMenu, onMainMenuToggle, sidebarMenus = {} }: SidebarProps = {}) {
|
|
180
|
+
function Sidebar({ currentMenu, onMainMenuToggle, sidebarMenus = {}, main_base_url = "" }: SidebarProps = {}) {
|
|
178
181
|
const pathname = usePathname()
|
|
179
182
|
const { state } = useSidebar()
|
|
183
|
+
const [settingsOpen, setSettingsOpen] = React.useState(false)
|
|
184
|
+
const settingsRef = React.useRef<HTMLDivElement>(null)
|
|
185
|
+
|
|
186
|
+
// Close dropdown on click outside
|
|
187
|
+
React.useEffect(() => {
|
|
188
|
+
function handleClickOutside(event: MouseEvent) {
|
|
189
|
+
if (settingsRef.current && !settingsRef.current.contains(event.target as Node)) {
|
|
190
|
+
setSettingsOpen(false)
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (settingsOpen) {
|
|
194
|
+
document.addEventListener("mousedown", handleClickOutside)
|
|
195
|
+
return () => document.removeEventListener("mousedown", handleClickOutside)
|
|
196
|
+
}
|
|
197
|
+
}, [settingsOpen])
|
|
180
198
|
|
|
181
199
|
// Micro apps: utilise 'items' comme clé standard
|
|
182
200
|
// Main app: utilise currentMenu pour sélectionner le bon groupe
|
|
183
|
-
const currentNavigation: SubMenuItem[] = sidebarMenus['items']
|
|
184
|
-
|| (currentMenu && sidebarMenus[currentMenu])
|
|
201
|
+
const currentNavigation: SubMenuItem[] = sidebarMenus['items']
|
|
202
|
+
|| (currentMenu && sidebarMenus[currentMenu])
|
|
185
203
|
|| []
|
|
186
204
|
|
|
187
205
|
return (
|
|
188
|
-
<div className="h-screen sticky top-0 flex flex-col bg-white border-r border-ui-border min-w-[var(--sidebar-width-icon)] transition-[width] duration-200"
|
|
206
|
+
<div className="h-screen sticky top-0 flex flex-col bg-white border-r border-ui-border min-w-[var(--sidebar-width-icon)] transition-[width] duration-200"
|
|
189
207
|
style={{ width: state === "expanded" ? "var(--sidebar-width)" : "var(--sidebar-width-icon)" }}>
|
|
190
208
|
{/* Logo avec bouton de menu principal */}
|
|
191
209
|
<div className="h-14 flex items-center justify-between px-4 border-b border-ui-border">
|
|
@@ -240,6 +258,45 @@ function Sidebar({ currentMenu, onMainMenuToggle, sidebarMenus = {} }: SidebarPr
|
|
|
240
258
|
)
|
|
241
259
|
})}
|
|
242
260
|
</nav>
|
|
261
|
+
|
|
262
|
+
{/* Footer - Menu Paramètres */}
|
|
263
|
+
<div className="relative border-t border-ui-border px-3 py-3" ref={settingsRef}>
|
|
264
|
+
{/* Dropdown vers le haut */}
|
|
265
|
+
{settingsOpen && (
|
|
266
|
+
<div className="absolute bottom-full left-2 right-2 mb-1 bg-white border border-ui-border rounded-lg shadow-lg z-50">
|
|
267
|
+
<div className="py-1">
|
|
268
|
+
<Link
|
|
269
|
+
href={`${main_base_url}/organization`}
|
|
270
|
+
onClick={() => setSettingsOpen(false)}
|
|
271
|
+
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"
|
|
272
|
+
>
|
|
273
|
+
<Building2 className="h-4 w-4" />
|
|
274
|
+
Organization
|
|
275
|
+
</Link>
|
|
276
|
+
<Link
|
|
277
|
+
href={`${main_base_url}/profile`}
|
|
278
|
+
onClick={() => setSettingsOpen(false)}
|
|
279
|
+
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"
|
|
280
|
+
>
|
|
281
|
+
<User className="h-4 w-4" />
|
|
282
|
+
Compte
|
|
283
|
+
</Link>
|
|
284
|
+
</div>
|
|
285
|
+
</div>
|
|
286
|
+
)}
|
|
287
|
+
<button
|
|
288
|
+
onClick={() => setSettingsOpen(!settingsOpen)}
|
|
289
|
+
className={cn(
|
|
290
|
+
"flex items-center w-full px-3 py-2 text-sm rounded-md gap-x-3 transition-colors",
|
|
291
|
+
settingsOpen
|
|
292
|
+
? "bg-interactive/10 text-interactive font-medium"
|
|
293
|
+
: "text-text-secondary hover:bg-ui-background hover:text-text-primary"
|
|
294
|
+
)}
|
|
295
|
+
>
|
|
296
|
+
<Settings className="h-4 w-4" />
|
|
297
|
+
{state === "expanded" && "Paramètres"}
|
|
298
|
+
</button>
|
|
299
|
+
</div>
|
|
243
300
|
</div>
|
|
244
301
|
)
|
|
245
302
|
}
|
package/components/ui/input.tsx
CHANGED
|
@@ -8,7 +8,7 @@ const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<"input">>(
|
|
|
8
8
|
<input
|
|
9
9
|
type={type}
|
|
10
10
|
className={cn(
|
|
11
|
-
"flex h-10 w-full border border-ibm-gray-30 bg-white px-3 py-1 text-base text-ibm-gray-100 placeholder:text-gray-500 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-blue-500 focus-visible:border-blue-500 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
11
|
+
"flex h-10 w-full border border-ibm-gray-30 bg-white px-3 py-1 text-base text-ibm-gray-100 placeholder:text-gray-500 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-blue-500 focus-visible:border-blue-500 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm invalid:border-carbon-red-60 invalid:focus-visible:ring-carbon-red-60",
|
|
12
12
|
className
|
|
13
13
|
)}
|
|
14
14
|
style={{ borderRadius: 0 }}
|
|
@@ -9,7 +9,7 @@ const Textarea = React.forwardRef<
|
|
|
9
9
|
return (
|
|
10
10
|
<textarea
|
|
11
11
|
className={cn(
|
|
12
|
-
"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
12
|
+
"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm invalid:border-carbon-red-60 invalid:focus-visible:ring-carbon-red-60",
|
|
13
13
|
className
|
|
14
14
|
)}
|
|
15
15
|
ref={ref}
|
package/lib/menu-utils.ts
CHANGED
|
@@ -41,7 +41,12 @@ export function getMenuFromPath(pathname: string): string {
|
|
|
41
41
|
if (pathname.startsWith("/access-manager")) {
|
|
42
42
|
return "access-manager"
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
|
|
45
|
+
// Routes pour Profile et Organization (pages paramètres)
|
|
46
|
+
if (pathname.startsWith("/profile") || pathname.startsWith("/organization")) {
|
|
47
|
+
return "overview"
|
|
48
|
+
}
|
|
49
|
+
|
|
45
50
|
// Par défaut, Vue d'ensemble
|
|
46
51
|
return "overview"
|
|
47
52
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orsetra/shared-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.45",
|
|
4
4
|
"description": "Shared UI components for Orsetra platform",
|
|
5
5
|
"main": "./index.ts",
|
|
6
6
|
"types": "./index.ts",
|
|
@@ -93,4 +93,4 @@
|
|
|
93
93
|
"next": "^16.0.7",
|
|
94
94
|
"typescript": "^5"
|
|
95
95
|
}
|
|
96
|
-
}
|
|
96
|
+
}
|