@snksergio/design-system 0.40.0 → 0.41.0
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/dist-lib/chunks/{avatar-DQYiVRlE.mjs → avatar-DFWEwBKu.mjs} +101 -51
- package/dist-lib/chunks/avatar-DFWEwBKu.mjs.map +1 -0
- package/dist-lib/chunks/{avatar-BiaG9OJS.cjs → avatar-eM5txRFZ.cjs} +53 -1
- package/dist-lib/chunks/avatar-eM5txRFZ.cjs.map +1 -0
- package/dist-lib/chunks/{input-CaC0B-_v.mjs → input-CfmzMYtd.mjs} +2 -2
- package/dist-lib/chunks/{input-CaC0B-_v.mjs.map → input-CfmzMYtd.mjs.map} +1 -1
- package/dist-lib/chunks/{input-DMH5rSP1.cjs → input-az2SuVXQ.cjs} +2 -2
- package/dist-lib/chunks/{input-DMH5rSP1.cjs.map → input-az2SuVXQ.cjs.map} +1 -1
- package/dist-lib/chunks/{kpi-delta-NnEu4oIs.cjs → kpi-delta-DAfakvFp.cjs} +3 -3
- package/dist-lib/chunks/{kpi-delta-NnEu4oIs.cjs.map → kpi-delta-DAfakvFp.cjs.map} +1 -1
- package/dist-lib/chunks/{kpi-delta-CjR0OsdC.mjs → kpi-delta-DaDwKOaP.mjs} +3 -3
- package/dist-lib/chunks/{kpi-delta-CjR0OsdC.mjs.map → kpi-delta-DaDwKOaP.mjs.map} +1 -1
- package/dist-lib/chunks/{page-header-DEGbgT4w.mjs → page-header--cPS_Z-a.mjs} +2 -2
- package/dist-lib/chunks/{page-header-DEGbgT4w.mjs.map → page-header--cPS_Z-a.mjs.map} +1 -1
- package/dist-lib/chunks/{page-header-Cp_9Wog4.cjs → page-header-DvAJoEfb.cjs} +2 -2
- package/dist-lib/chunks/{page-header-Cp_9Wog4.cjs.map → page-header-DvAJoEfb.cjs.map} +1 -1
- package/dist-lib/chunks/{panel-B1xKDbjB.mjs → panel-Bje0kUTh.mjs} +5 -5
- package/dist-lib/chunks/{panel-B1xKDbjB.mjs.map → panel-Bje0kUTh.mjs.map} +1 -1
- package/dist-lib/chunks/{panel-ma7e3s4C.cjs → panel-DtU3KlKY.cjs} +5 -5
- package/dist-lib/chunks/{panel-ma7e3s4C.cjs.map → panel-DtU3KlKY.cjs.map} +1 -1
- package/dist-lib/chunks/{textarea-DivoQmJw.mjs → textarea-BPRIHZVd.mjs} +2 -2
- package/dist-lib/chunks/{textarea-DivoQmJw.mjs.map → textarea-BPRIHZVd.mjs.map} +1 -1
- package/dist-lib/chunks/{textarea-c80RFmMP.cjs → textarea-K20CL_gF.cjs} +2 -2
- package/dist-lib/chunks/{textarea-c80RFmMP.cjs.map → textarea-K20CL_gF.cjs.map} +1 -1
- package/dist-lib/chunks/{tooltip-pvZ_X-Ub.cjs → toggle-group-BEPs3e0Y.cjs} +2 -54
- package/dist-lib/chunks/toggle-group-BEPs3e0Y.cjs.map +1 -0
- package/dist-lib/chunks/{tooltip-mMF4YHZg.mjs → toggle-group-XMO6ReVo.mjs} +77 -127
- package/dist-lib/chunks/toggle-group-XMO6ReVo.mjs.map +1 -0
- package/dist-lib/chunks/{useTheme-BD0nloAv.cjs → useTheme-3iZAognE.cjs} +876 -73
- package/dist-lib/chunks/useTheme-3iZAognE.cjs.map +1 -0
- package/dist-lib/chunks/{useTheme-D1QVzZDW.mjs → useTheme-B3ZakPqk.mjs} +886 -83
- package/dist-lib/chunks/useTheme-B3ZakPqk.mjs.map +1 -0
- package/dist-lib/index.cjs +40 -732
- package/dist-lib/index.cjs.map +1 -1
- package/dist-lib/index.mjs +94 -786
- package/dist-lib/index.mjs.map +1 -1
- package/dist-lib/preview/chat.cjs +3 -3
- package/dist-lib/preview/chat.mjs +3 -3
- package/dist-lib/preview/clientes.cjs +6 -6
- package/dist-lib/preview/clientes.mjs +6 -6
- package/dist-lib/preview/dashboard.cjs +4 -4
- package/dist-lib/preview/dashboard.mjs +4 -4
- package/dist-lib/shadcn.cjs +112 -112
- package/dist-lib/shadcn.mjs +136 -136
- package/dist-lib/src/components/ui/AppShell/app-shell.d.ts +1 -1
- package/dist-lib/src/components/ui/AppShell/app-shell.d.ts.map +1 -1
- package/dist-lib/src/components/ui/AppShell/app-shell.styles.d.ts +45 -1
- package/dist-lib/src/components/ui/AppShell/app-shell.styles.d.ts.map +1 -1
- package/dist-lib/src/components/ui/AppShell/app-shell.types.d.ts +106 -3
- package/dist-lib/src/components/ui/AppShell/app-shell.types.d.ts.map +1 -1
- package/dist-lib/src/components/ui/MenuSidebar/index.d.ts +2 -2
- package/dist-lib/src/components/ui/MenuSidebar/index.d.ts.map +1 -1
- package/dist-lib/src/components/ui/SingleMenuSidebar/category.d.ts +1 -1
- package/dist-lib/src/components/ui/SingleMenuSidebar/category.d.ts.map +1 -1
- package/dist-lib/src/components/ui/SingleMenuSidebar/menu-item.d.ts +25 -1
- package/dist-lib/src/components/ui/SingleMenuSidebar/menu-item.d.ts.map +1 -1
- package/dist-lib/src/components/ui/SingleMenuSidebar/single-menu-sidebar.d.ts +1 -1
- package/dist-lib/src/components/ui/SingleMenuSidebar/single-menu-sidebar.d.ts.map +1 -1
- package/dist-lib/src/components/ui/SingleMenuSidebar/single-menu-sidebar.types.d.ts +57 -2
- package/dist-lib/src/components/ui/SingleMenuSidebar/single-menu-sidebar.types.d.ts.map +1 -1
- package/dist-lib/src/utils/nav-link.d.ts.map +1 -0
- package/package.json +207 -207
- package/dist-lib/chunks/avatar-BiaG9OJS.cjs.map +0 -1
- package/dist-lib/chunks/avatar-DQYiVRlE.mjs.map +0 -1
- package/dist-lib/chunks/tooltip-mMF4YHZg.mjs.map +0 -1
- package/dist-lib/chunks/tooltip-pvZ_X-Ub.cjs.map +0 -1
- package/dist-lib/chunks/useTheme-BD0nloAv.cjs.map +0 -1
- package/dist-lib/chunks/useTheme-D1QVzZDW.mjs.map +0 -1
- package/dist-lib/src/components/ui/MenuSidebar/nav-link.d.ts.map +0 -1
- /package/dist-lib/src/{components/ui/MenuSidebar → utils}/nav-link.d.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment as Fragment$1, useState, useEffect, forwardRef, createContext, useContext, useCallback, useRef } from "react";
|
|
3
|
-
import { t as tv, c as cn, B as Button,
|
|
4
|
-
import { ChevronRight, Search, Bell, CheckCheck, MoreHorizontal, MessageSquare, PenLine, Maximize2, Sun, Moon, Check, PanelLeftOpen, PanelLeftClose, Menu, Plus, ChevronDown, X, LayoutGrid, SunMoon, Settings, LogOut } from "lucide-react";
|
|
2
|
+
import { Fragment as Fragment$1, useState, useEffect, forwardRef, createContext, useContext, useCallback, useRef, useMemo } from "react";
|
|
3
|
+
import { t as tv, c as cn, B as Button, g as CommandDialog, j as CommandInput, l as CommandList, h as CommandEmpty, i as CommandGroup, k as CommandItem, n as CommandShortcut, m as CommandSeparator, X as Popover, $ as PopoverTrigger, _ as PopoverContent, R as InputGroup, S as InputGroupAddon, U as InputGroupInput, y as DropdownMenu, Q as DropdownMenuTrigger, E as DropdownMenuContent, G as DropdownMenuItem, a0 as Tooltip, a3 as TooltipTrigger, a1 as TooltipContent, C as Collapsible, e as CollapsibleTrigger, d as CollapsibleContent, F as DropdownMenuGroup, H as DropdownMenuLabel, L as DropdownMenuSeparator, a2 as TooltipProvider, A as Avatar, b as AvatarImage, a as AvatarFallback, N as DropdownMenuSub, P as DropdownMenuSubTrigger, O as DropdownMenuSubContent, J as DropdownMenuRadioGroup, K as DropdownMenuRadioItem } from "./avatar-DFWEwBKu.mjs";
|
|
4
|
+
import { ChevronRight, Search, Bell, CheckCheck, MoreHorizontal, MessageSquare, PenLine, Maximize2, Sun, Moon, Check, PanelLeftOpen, PanelLeftClose, Menu, Plus, ChevronDown, X, ChevronsUpDown, User, LayoutGrid, SunMoon, Settings, LogOut } from "lucide-react";
|
|
5
5
|
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
6
6
|
const headerRoot = tv({
|
|
7
7
|
base: [
|
|
@@ -1186,7 +1186,7 @@ function Header({
|
|
|
1186
1186
|
] })
|
|
1187
1187
|
] });
|
|
1188
1188
|
}
|
|
1189
|
-
const sidebarRoot = tv({
|
|
1189
|
+
const sidebarRoot$1 = tv({
|
|
1190
1190
|
base: "relative flex h-screen w-fit bg-bg-sidebar text-fg-default font-sans",
|
|
1191
1191
|
variants: {
|
|
1192
1192
|
mobile: {
|
|
@@ -2169,7 +2169,7 @@ function MenuSidebar({
|
|
|
2169
2169
|
"div",
|
|
2170
2170
|
{
|
|
2171
2171
|
className: cn(
|
|
2172
|
-
sidebarRoot({ mobile: isMobile, mobileOpen: isMobile && openMobile }),
|
|
2172
|
+
sidebarRoot$1({ mobile: isMobile, mobileOpen: isMobile && openMobile }),
|
|
2173
2173
|
className
|
|
2174
2174
|
),
|
|
2175
2175
|
onMouseEnter: () => {
|
|
@@ -2240,6 +2240,752 @@ function MenuSidebar({
|
|
|
2240
2240
|
)
|
|
2241
2241
|
] });
|
|
2242
2242
|
}
|
|
2243
|
+
const SingleMenuSidebarContext = createContext({
|
|
2244
|
+
expanded: true,
|
|
2245
|
+
isHoverExpand: false,
|
|
2246
|
+
toggle: () => {
|
|
2247
|
+
},
|
|
2248
|
+
openCategoryId: null,
|
|
2249
|
+
setOpenCategoryId: () => {
|
|
2250
|
+
}
|
|
2251
|
+
});
|
|
2252
|
+
function useSingleMenuSidebar() {
|
|
2253
|
+
return useContext(SingleMenuSidebarContext);
|
|
2254
|
+
}
|
|
2255
|
+
function useSingleMenuSidebarState(defaultExpanded, controlledExpanded, onExpandedChange) {
|
|
2256
|
+
const [internal, setInternal] = useState(defaultExpanded);
|
|
2257
|
+
const isControlled = controlledExpanded !== void 0;
|
|
2258
|
+
const expanded = isControlled ? controlledExpanded : internal;
|
|
2259
|
+
const [lockedOpen, setLockedOpen] = useState(defaultExpanded);
|
|
2260
|
+
const [hoverOpen, setHoverOpen] = useState(false);
|
|
2261
|
+
const hoverTimeoutRef = useRef(null);
|
|
2262
|
+
const suppressHoverRef = useRef(false);
|
|
2263
|
+
const suppressTimerRef = useRef(null);
|
|
2264
|
+
const setExpanded = useCallback(
|
|
2265
|
+
(v) => {
|
|
2266
|
+
if (!isControlled) setInternal(v);
|
|
2267
|
+
onExpandedChange?.(v);
|
|
2268
|
+
},
|
|
2269
|
+
[isControlled, onExpandedChange]
|
|
2270
|
+
);
|
|
2271
|
+
const toggle = useCallback(() => {
|
|
2272
|
+
const next = !lockedOpen;
|
|
2273
|
+
setLockedOpen(next);
|
|
2274
|
+
setHoverOpen(false);
|
|
2275
|
+
if (!next) {
|
|
2276
|
+
suppressHoverRef.current = true;
|
|
2277
|
+
if (suppressTimerRef.current) clearTimeout(suppressTimerRef.current);
|
|
2278
|
+
suppressTimerRef.current = setTimeout(() => {
|
|
2279
|
+
suppressHoverRef.current = false;
|
|
2280
|
+
}, 500);
|
|
2281
|
+
}
|
|
2282
|
+
setExpanded(next);
|
|
2283
|
+
}, [lockedOpen, setExpanded]);
|
|
2284
|
+
const onMouseEnter = useCallback(() => {
|
|
2285
|
+
if (lockedOpen) return;
|
|
2286
|
+
if (suppressHoverRef.current) return;
|
|
2287
|
+
if (hoverTimeoutRef.current) {
|
|
2288
|
+
clearTimeout(hoverTimeoutRef.current);
|
|
2289
|
+
hoverTimeoutRef.current = null;
|
|
2290
|
+
}
|
|
2291
|
+
setHoverOpen(true);
|
|
2292
|
+
setExpanded(true);
|
|
2293
|
+
}, [lockedOpen, setExpanded]);
|
|
2294
|
+
const onMouseLeave = useCallback(() => {
|
|
2295
|
+
if (lockedOpen) return;
|
|
2296
|
+
hoverTimeoutRef.current = setTimeout(() => {
|
|
2297
|
+
setHoverOpen(false);
|
|
2298
|
+
setExpanded(false);
|
|
2299
|
+
}, 200);
|
|
2300
|
+
}, [lockedOpen, setExpanded]);
|
|
2301
|
+
useEffect(() => {
|
|
2302
|
+
return () => {
|
|
2303
|
+
if (hoverTimeoutRef.current) clearTimeout(hoverTimeoutRef.current);
|
|
2304
|
+
if (suppressTimerRef.current) clearTimeout(suppressTimerRef.current);
|
|
2305
|
+
};
|
|
2306
|
+
}, []);
|
|
2307
|
+
const isHoverExpand = hoverOpen && !lockedOpen;
|
|
2308
|
+
const [openCategoryId, setOpenCategoryId] = useState(null);
|
|
2309
|
+
return {
|
|
2310
|
+
expanded,
|
|
2311
|
+
isHoverExpand,
|
|
2312
|
+
toggle,
|
|
2313
|
+
onMouseEnter,
|
|
2314
|
+
onMouseLeave,
|
|
2315
|
+
openCategoryId,
|
|
2316
|
+
setOpenCategoryId
|
|
2317
|
+
};
|
|
2318
|
+
}
|
|
2319
|
+
const sidebarRoot = tv({
|
|
2320
|
+
base: [
|
|
2321
|
+
"relative flex h-full flex-col overflow-x-hidden",
|
|
2322
|
+
"border-r border-border-sidebar bg-bg-sidebar",
|
|
2323
|
+
"transition-[width] duration-300 ease-in-out"
|
|
2324
|
+
],
|
|
2325
|
+
variants: {
|
|
2326
|
+
// Mobile (< md): expandida = 100% da largura; recolhida = SOME (hidden).
|
|
2327
|
+
// Desktop (md+): largura fixa, expandida (280px) ou recolhida (rail 80px).
|
|
2328
|
+
expanded: {
|
|
2329
|
+
true: "w-full md:w-[280px]",
|
|
2330
|
+
false: "hidden md:flex md:w-20"
|
|
2331
|
+
}
|
|
2332
|
+
},
|
|
2333
|
+
defaultVariants: {
|
|
2334
|
+
expanded: true
|
|
2335
|
+
}
|
|
2336
|
+
});
|
|
2337
|
+
const category = tv({
|
|
2338
|
+
slots: {
|
|
2339
|
+
root: "flex items-center rounded-radius-lg cursor-pointer transition-all",
|
|
2340
|
+
text: "flex-1 text-left text-body-sm whitespace-nowrap overflow-hidden text-ellipsis",
|
|
2341
|
+
// SVG do consumidor (ícone bare do lucide vem 24px) dimensionado no slot → 18px
|
|
2342
|
+
icon: "grid size-[18px] shrink-0 place-items-center [&>svg]:size-[18px]",
|
|
2343
|
+
chevron: "size-icon-sm shrink-0 transition-transform"
|
|
2344
|
+
},
|
|
2345
|
+
variants: {
|
|
2346
|
+
// selected = folha ativa OU pai que contém o item ativo → card cheio
|
|
2347
|
+
// default = nada marcado (inclui pai apenas aberto, sem filho ativo)
|
|
2348
|
+
state: {
|
|
2349
|
+
selected: {
|
|
2350
|
+
root: "bg-bg-sidebar-accent shadow-sh-sm",
|
|
2351
|
+
text: "font-bold text-fg-brand",
|
|
2352
|
+
icon: "text-fg-brand",
|
|
2353
|
+
chevron: "text-fg-brand"
|
|
2354
|
+
},
|
|
2355
|
+
default: {
|
|
2356
|
+
root: "hover:bg-bg-sidebar-accent",
|
|
2357
|
+
text: "font-medium text-fg-default",
|
|
2358
|
+
icon: "text-fg-muted",
|
|
2359
|
+
chevron: "text-fg-subtle"
|
|
2360
|
+
}
|
|
2361
|
+
},
|
|
2362
|
+
collapsed: {
|
|
2363
|
+
true: { root: "justify-center px-0 size-form-xl" },
|
|
2364
|
+
false: { root: "w-full gap-gp-lg px-pad-2xl py-pad-xl" }
|
|
2365
|
+
}
|
|
2366
|
+
},
|
|
2367
|
+
defaultVariants: {
|
|
2368
|
+
state: "default",
|
|
2369
|
+
collapsed: false
|
|
2370
|
+
}
|
|
2371
|
+
});
|
|
2372
|
+
const menuItem = tv({
|
|
2373
|
+
slots: {
|
|
2374
|
+
root: "flex h-[38px] items-center gap-[18px] pl-[18px] pr-pad-2xl cursor-pointer transition-colors hover:bg-bg-sidebar-accent",
|
|
2375
|
+
border: "h-full w-0 shrink-0",
|
|
2376
|
+
text: "text-body-sm text-left"
|
|
2377
|
+
},
|
|
2378
|
+
variants: {
|
|
2379
|
+
selected: {
|
|
2380
|
+
true: {
|
|
2381
|
+
border: "border-l-[3px] border-border-brand",
|
|
2382
|
+
text: "font-semibold text-fg-default"
|
|
2383
|
+
},
|
|
2384
|
+
false: {
|
|
2385
|
+
border: "border-l border-border-subtle",
|
|
2386
|
+
text: "font-medium text-fg-muted"
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2389
|
+
},
|
|
2390
|
+
defaultVariants: {
|
|
2391
|
+
selected: false
|
|
2392
|
+
}
|
|
2393
|
+
});
|
|
2394
|
+
const styles = {
|
|
2395
|
+
// Header
|
|
2396
|
+
header: {
|
|
2397
|
+
wrapper: "flex h-layout-navbar items-center overflow-hidden px-pad-4xl py-pad-md shrink-0",
|
|
2398
|
+
wrapperCollapsed: "justify-center px-0",
|
|
2399
|
+
inner: "flex items-center gap-gp-md",
|
|
2400
|
+
logo: "shrink-0",
|
|
2401
|
+
title: "text-title-sm font-bold text-fg-default whitespace-nowrap",
|
|
2402
|
+
collapseBtn: "ml-auto shrink-0 cursor-pointer rounded-radius-md p-pad-xs text-fg-subtle hover:bg-bg-sidebar-accent hover:text-fg-muted transition-colors",
|
|
2403
|
+
expandBtn: "absolute right-0 top-16 translate-x-1/2 z-10 cursor-pointer rounded-radius-full bg-bg-surface border border-border-default p-pad-xs shadow-sh-sm text-fg-subtle hover:text-fg-muted transition-colors",
|
|
2404
|
+
expandBtnIcon: "size-icon-sm"
|
|
2405
|
+
},
|
|
2406
|
+
// Module selector
|
|
2407
|
+
module: {
|
|
2408
|
+
trigger: "flex w-full cursor-pointer items-center gap-gp-lg rounded-radius-md bg-bg-sidebar-accent py-pad-md pl-pad-md pr-pad-2xl shadow-sh-sm transition-colors hover:bg-bg-sidebar-accent-hover focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring-brand",
|
|
2409
|
+
iconContainer: "flex size-icon-xl shrink-0 items-center justify-center rounded-radius-md bg-bg-brand text-fg-on-brand",
|
|
2410
|
+
textContainer: "flex flex-col items-start gap-gp-xs overflow-hidden",
|
|
2411
|
+
title: "text-body-md font-bold leading-4 text-fg-default truncate text-left",
|
|
2412
|
+
subtitle: "text-caption-sm font-semibold text-fg-subtle text-left",
|
|
2413
|
+
chevron: "ml-auto shrink-0 size-icon-sm text-fg-subtle",
|
|
2414
|
+
dropdownItem: "flex items-center gap-gp-lg cursor-pointer",
|
|
2415
|
+
// selecionado: realça a linha (bg-brand-subtle) + label/check em fg-brand
|
|
2416
|
+
dropdownItemSelected: "bg-bg-brand-subtle text-fg-brand",
|
|
2417
|
+
// [&>svg]:!text-fg-on-brand: o DropdownMenuItem força [&_svg]:text-fg-muted
|
|
2418
|
+
// (+ fg-default no hover) em TODOS os svgs descendentes — o ! garante que o
|
|
2419
|
+
// ícone do chip siga fg-on-brand igual ao trigger (branco light / preto dark).
|
|
2420
|
+
dropdownItemIcon: "flex size-icon-lg shrink-0 items-center justify-center rounded-radius-sm bg-bg-brand [&>svg]:size-icon-sm [&>svg]:!text-fg-on-brand",
|
|
2421
|
+
dropdownItemLabel: "flex-1 text-body-md font-medium",
|
|
2422
|
+
dropdownItemCheck: "ml-auto shrink-0 size-icon-sm !text-fg-brand"
|
|
2423
|
+
},
|
|
2424
|
+
// Search
|
|
2425
|
+
search: {
|
|
2426
|
+
wrapper: "flex w-full items-center justify-between rounded-radius-lg bg-bg-muted py-pad-sm pl-pad-lg pr-pad-sm transition-all focus-within:bg-bg-surface focus-within:ring-4 focus-within:ring-ring-brand",
|
|
2427
|
+
inner: "flex flex-1 items-center gap-gp-md opacity-60 focus-within:opacity-100",
|
|
2428
|
+
icon: "shrink-0 size-icon-sm text-fg-muted",
|
|
2429
|
+
text: "text-body-sm font-medium text-fg-default placeholder:text-fg-subtle",
|
|
2430
|
+
shortcutBadge: "shrink-0 flex items-center justify-center rounded-radius-md bg-bg-surface px-pad-md py-pad-xs shadow-sh-sm",
|
|
2431
|
+
shortcutText: "text-body-sm font-medium text-fg-muted"
|
|
2432
|
+
},
|
|
2433
|
+
// Footer
|
|
2434
|
+
footer: {
|
|
2435
|
+
wrapper: "px-pad-lg py-pad-xl",
|
|
2436
|
+
button: "flex w-full cursor-pointer items-center gap-gp-lg rounded-radius-lg bg-bg-sidebar-accent px-pad-2xl py-pad-xl transition-colors hover:bg-bg-sidebar-accent-hover focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring-brand",
|
|
2437
|
+
avatar: "flex size-form-sm shrink-0 items-center justify-center rounded-radius-full bg-bg-muted overflow-hidden",
|
|
2438
|
+
avatarIcon: "shrink-0 size-icon-sm text-fg-muted",
|
|
2439
|
+
textContainer: "flex flex-col items-start gap-gp-2xs overflow-hidden",
|
|
2440
|
+
name: "text-body-sm font-semibold text-fg-default truncate w-full text-left",
|
|
2441
|
+
email: "text-caption-sm font-medium text-fg-muted truncate w-full text-left",
|
|
2442
|
+
chevron: "ml-auto shrink-0 size-icon-sm text-fg-subtle",
|
|
2443
|
+
dropdownLabel: "flex flex-col gap-gp-2xs px-pad-sm py-pad-xs normal-case tracking-normal",
|
|
2444
|
+
dropdownLabelName: "text-body-md font-semibold",
|
|
2445
|
+
dropdownLabelEmail: "text-caption-md font-normal text-fg-muted",
|
|
2446
|
+
dropdownItem: "flex items-center gap-gp-md cursor-pointer",
|
|
2447
|
+
dropdownItemIcon: "size-icon-sm shrink-0"
|
|
2448
|
+
},
|
|
2449
|
+
// Layout
|
|
2450
|
+
// Fade do conteúdo textual durante a transição de largura (evita wrap visível)
|
|
2451
|
+
textFadeIn: "animate-in fade-in-0 duration-200",
|
|
2452
|
+
divider: "mx-pad-3xl h-px bg-border-sidebar",
|
|
2453
|
+
sectionPadding: "flex flex-col gap-gp-2xl px-pad-3xl py-pad-4xl shrink-0 overflow-hidden",
|
|
2454
|
+
navContainer: "scrollbar-thin flex flex-1 flex-col overflow-y-auto overflow-x-hidden py-pad-4xl",
|
|
2455
|
+
navContainerExpanded: "px-pad-3xl",
|
|
2456
|
+
navContainerCollapsed: "items-center",
|
|
2457
|
+
navList: "flex flex-col",
|
|
2458
|
+
subItemList: "flex flex-col py-pad-lg"
|
|
2459
|
+
};
|
|
2460
|
+
function SingleMenuHeader({
|
|
2461
|
+
logo,
|
|
2462
|
+
title,
|
|
2463
|
+
showToggleIndicator = false
|
|
2464
|
+
}) {
|
|
2465
|
+
const { expanded, isHoverExpand, toggle } = useSingleMenuSidebar();
|
|
2466
|
+
const isFlipped = isHoverExpand || !expanded;
|
|
2467
|
+
return /* @__PURE__ */ jsxs(
|
|
2468
|
+
"div",
|
|
2469
|
+
{
|
|
2470
|
+
className: cn(
|
|
2471
|
+
styles.header.wrapper,
|
|
2472
|
+
!expanded && styles.header.wrapperCollapsed
|
|
2473
|
+
),
|
|
2474
|
+
children: [
|
|
2475
|
+
/* @__PURE__ */ jsxs("div", { className: styles.header.inner, children: [
|
|
2476
|
+
/* @__PURE__ */ jsx("div", { className: styles.header.logo, children: logo }),
|
|
2477
|
+
expanded && /* @__PURE__ */ jsx("span", { className: cn(styles.header.title, styles.textFadeIn), children: title })
|
|
2478
|
+
] }),
|
|
2479
|
+
expanded ? /* @__PURE__ */ jsx(
|
|
2480
|
+
"button",
|
|
2481
|
+
{
|
|
2482
|
+
type: "button",
|
|
2483
|
+
onClick: toggle,
|
|
2484
|
+
className: styles.header.collapseBtn,
|
|
2485
|
+
"aria-label": isFlipped ? "Expandir sidebar" : "Recolher sidebar",
|
|
2486
|
+
children: /* @__PURE__ */ jsx(
|
|
2487
|
+
PanelLeftClose,
|
|
2488
|
+
{
|
|
2489
|
+
className: cn(
|
|
2490
|
+
"size-icon-sm transition-transform duration-300",
|
|
2491
|
+
isFlipped && "rotate-180"
|
|
2492
|
+
)
|
|
2493
|
+
}
|
|
2494
|
+
)
|
|
2495
|
+
}
|
|
2496
|
+
) : showToggleIndicator ? /* @__PURE__ */ jsx(
|
|
2497
|
+
"button",
|
|
2498
|
+
{
|
|
2499
|
+
type: "button",
|
|
2500
|
+
onClick: toggle,
|
|
2501
|
+
className: styles.header.expandBtn,
|
|
2502
|
+
"aria-label": "Expandir sidebar",
|
|
2503
|
+
children: /* @__PURE__ */ jsx(
|
|
2504
|
+
PanelLeftClose,
|
|
2505
|
+
{
|
|
2506
|
+
className: cn(
|
|
2507
|
+
styles.header.expandBtnIcon,
|
|
2508
|
+
"transition-transform duration-300 rotate-180"
|
|
2509
|
+
)
|
|
2510
|
+
}
|
|
2511
|
+
)
|
|
2512
|
+
}
|
|
2513
|
+
) : null
|
|
2514
|
+
]
|
|
2515
|
+
}
|
|
2516
|
+
);
|
|
2517
|
+
}
|
|
2518
|
+
SingleMenuHeader.displayName = "SingleMenuHeader";
|
|
2519
|
+
function SingleMenuModuleSelector({
|
|
2520
|
+
icon,
|
|
2521
|
+
title,
|
|
2522
|
+
subtitle,
|
|
2523
|
+
options,
|
|
2524
|
+
onModuleChange
|
|
2525
|
+
}) {
|
|
2526
|
+
const s = styles.module;
|
|
2527
|
+
const triggerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2528
|
+
/* @__PURE__ */ jsx("div", { className: s.iconContainer, children: icon }),
|
|
2529
|
+
/* @__PURE__ */ jsxs("div", { className: s.textContainer, children: [
|
|
2530
|
+
/* @__PURE__ */ jsx("span", { className: s.title, children: title }),
|
|
2531
|
+
/* @__PURE__ */ jsx("span", { className: s.subtitle, children: subtitle })
|
|
2532
|
+
] }),
|
|
2533
|
+
/* @__PURE__ */ jsx(ChevronsUpDown, { className: s.chevron })
|
|
2534
|
+
] });
|
|
2535
|
+
if (!options || options.length === 0) {
|
|
2536
|
+
return /* @__PURE__ */ jsx("div", { className: s.trigger, children: triggerContent });
|
|
2537
|
+
}
|
|
2538
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
2539
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { className: s.trigger, children: triggerContent }),
|
|
2540
|
+
/* @__PURE__ */ jsx(DropdownMenuContent, { side: "bottom", sideOffset: 4, align: "start", children: options.map((option) => {
|
|
2541
|
+
const isSelected = option.label === title;
|
|
2542
|
+
return /* @__PURE__ */ jsxs(
|
|
2543
|
+
DropdownMenuItem,
|
|
2544
|
+
{
|
|
2545
|
+
className: cn(
|
|
2546
|
+
s.dropdownItem,
|
|
2547
|
+
isSelected && s.dropdownItemSelected
|
|
2548
|
+
),
|
|
2549
|
+
onClick: () => onModuleChange?.(option.id),
|
|
2550
|
+
children: [
|
|
2551
|
+
/* @__PURE__ */ jsx("div", { className: s.dropdownItemIcon, children: option.icon }),
|
|
2552
|
+
/* @__PURE__ */ jsx("span", { className: s.dropdownItemLabel, children: option.label }),
|
|
2553
|
+
isSelected && /* @__PURE__ */ jsx(Check, { className: s.dropdownItemCheck })
|
|
2554
|
+
]
|
|
2555
|
+
},
|
|
2556
|
+
option.id
|
|
2557
|
+
);
|
|
2558
|
+
}) })
|
|
2559
|
+
] });
|
|
2560
|
+
}
|
|
2561
|
+
SingleMenuModuleSelector.displayName = "SingleMenuModuleSelector";
|
|
2562
|
+
function SingleMenuSearch({
|
|
2563
|
+
placeholder = "Buscar",
|
|
2564
|
+
onOpen
|
|
2565
|
+
}) {
|
|
2566
|
+
const s = styles.search;
|
|
2567
|
+
return /* @__PURE__ */ jsxs("button", { type: "button", onClick: onOpen, className: s.wrapper, children: [
|
|
2568
|
+
/* @__PURE__ */ jsxs("div", { className: s.inner, children: [
|
|
2569
|
+
/* @__PURE__ */ jsx(Search, { className: s.icon }),
|
|
2570
|
+
/* @__PURE__ */ jsx("span", { className: s.text, children: placeholder })
|
|
2571
|
+
] }),
|
|
2572
|
+
/* @__PURE__ */ jsx("div", { className: s.shortcutBadge, children: /* @__PURE__ */ jsx("span", { className: s.shortcutText, children: "⌘K" }) })
|
|
2573
|
+
] });
|
|
2574
|
+
}
|
|
2575
|
+
SingleMenuSearch.displayName = "SingleMenuSearch";
|
|
2576
|
+
function SingleMenuCommand({
|
|
2577
|
+
open,
|
|
2578
|
+
onOpenChange,
|
|
2579
|
+
categories,
|
|
2580
|
+
placeholder = "Buscar no menu…",
|
|
2581
|
+
onSelect,
|
|
2582
|
+
custom
|
|
2583
|
+
}) {
|
|
2584
|
+
const leaves = categories.filter((c) => !c.items?.length);
|
|
2585
|
+
const groups = categories.filter((c) => c.items?.length);
|
|
2586
|
+
const handle = (id, parentId) => {
|
|
2587
|
+
onSelect(id, parentId);
|
|
2588
|
+
onOpenChange(false);
|
|
2589
|
+
};
|
|
2590
|
+
return /* @__PURE__ */ jsxs(CommandDialog, { open, onOpenChange, children: [
|
|
2591
|
+
/* @__PURE__ */ jsx(CommandInput, { placeholder }),
|
|
2592
|
+
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
2593
|
+
/* @__PURE__ */ jsx(CommandEmpty, { children: "Nenhum resultado." }),
|
|
2594
|
+
custom ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2595
|
+
leaves.length > 0 && /* @__PURE__ */ jsx(CommandGroup, { heading: "Menu", children: leaves.map((c) => /* @__PURE__ */ jsxs(
|
|
2596
|
+
CommandItem,
|
|
2597
|
+
{
|
|
2598
|
+
value: c.label,
|
|
2599
|
+
onSelect: () => handle(c.id),
|
|
2600
|
+
children: [
|
|
2601
|
+
c.icon,
|
|
2602
|
+
/* @__PURE__ */ jsx("span", { children: c.label })
|
|
2603
|
+
]
|
|
2604
|
+
},
|
|
2605
|
+
c.id
|
|
2606
|
+
)) }),
|
|
2607
|
+
groups.map((cat) => /* @__PURE__ */ jsx(CommandGroup, { heading: cat.label, children: cat.items.map((item) => /* @__PURE__ */ jsx(
|
|
2608
|
+
CommandItem,
|
|
2609
|
+
{
|
|
2610
|
+
value: `${cat.label} ${item.label}`,
|
|
2611
|
+
onSelect: () => handle(item.id, cat.id),
|
|
2612
|
+
children: /* @__PURE__ */ jsx("span", { children: item.label })
|
|
2613
|
+
},
|
|
2614
|
+
item.id
|
|
2615
|
+
)) }, cat.id))
|
|
2616
|
+
] })
|
|
2617
|
+
] })
|
|
2618
|
+
] });
|
|
2619
|
+
}
|
|
2620
|
+
SingleMenuCommand.displayName = "SingleMenuCommand";
|
|
2621
|
+
function SingleMenuItem({
|
|
2622
|
+
label,
|
|
2623
|
+
selected = false,
|
|
2624
|
+
href,
|
|
2625
|
+
target,
|
|
2626
|
+
onClick,
|
|
2627
|
+
renderLink,
|
|
2628
|
+
interceptNavigation
|
|
2629
|
+
}) {
|
|
2630
|
+
const s = menuItem({ selected });
|
|
2631
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2632
|
+
/* @__PURE__ */ jsx("div", { className: s.border() }),
|
|
2633
|
+
/* @__PURE__ */ jsx("span", { className: s.text(), children: label })
|
|
2634
|
+
] });
|
|
2635
|
+
const handleClick = (e) => {
|
|
2636
|
+
if (!renderLink) {
|
|
2637
|
+
const prevent = shouldPreventNavigation({
|
|
2638
|
+
href,
|
|
2639
|
+
hasHandler: interceptNavigation ?? !!onClick,
|
|
2640
|
+
target,
|
|
2641
|
+
event: e
|
|
2642
|
+
});
|
|
2643
|
+
if (prevent) e.preventDefault();
|
|
2644
|
+
}
|
|
2645
|
+
onClick?.(e);
|
|
2646
|
+
};
|
|
2647
|
+
if (href) {
|
|
2648
|
+
const linkProps = {
|
|
2649
|
+
href,
|
|
2650
|
+
target,
|
|
2651
|
+
className: s.root(),
|
|
2652
|
+
onClick: handleClick,
|
|
2653
|
+
"aria-current": selected ? "page" : void 0,
|
|
2654
|
+
children: content
|
|
2655
|
+
};
|
|
2656
|
+
if (renderLink) return /* @__PURE__ */ jsx(Fragment, { children: renderLink(linkProps) });
|
|
2657
|
+
return /* @__PURE__ */ jsx("a", { ...linkProps });
|
|
2658
|
+
}
|
|
2659
|
+
return /* @__PURE__ */ jsx("button", { type: "button", onClick: handleClick, className: s.root(), children: content });
|
|
2660
|
+
}
|
|
2661
|
+
SingleMenuItem.displayName = "SingleMenuItem";
|
|
2662
|
+
function SingleMenuCategory({
|
|
2663
|
+
id,
|
|
2664
|
+
icon,
|
|
2665
|
+
label,
|
|
2666
|
+
active = false,
|
|
2667
|
+
items,
|
|
2668
|
+
activeItemId,
|
|
2669
|
+
onItemClick,
|
|
2670
|
+
onCategoryClick,
|
|
2671
|
+
href,
|
|
2672
|
+
renderLink
|
|
2673
|
+
}) {
|
|
2674
|
+
const { expanded, openCategoryId, setOpenCategoryId } = useSingleMenuSidebar();
|
|
2675
|
+
const hasItems = !!items && items.length > 0;
|
|
2676
|
+
const isOpen = hasItems ? openCategoryId === id : false;
|
|
2677
|
+
const isLeafActive = !hasItems && (activeItemId !== void 0 ? activeItemId === id : !!active);
|
|
2678
|
+
const containsActive = hasItems && items.some((item) => item.id === activeItemId);
|
|
2679
|
+
const selected = !expanded ? hasItems ? isOpen || containsActive : isLeafActive : hasItems ? isOpen : isLeafActive && openCategoryId == null;
|
|
2680
|
+
const state = selected ? "selected" : "default";
|
|
2681
|
+
const s = category({ state, collapsed: !expanded });
|
|
2682
|
+
const handleToggle = () => {
|
|
2683
|
+
if (hasItems) {
|
|
2684
|
+
setOpenCategoryId(isOpen ? null : id);
|
|
2685
|
+
onCategoryClick?.();
|
|
2686
|
+
} else {
|
|
2687
|
+
onItemClick?.(id);
|
|
2688
|
+
setOpenCategoryId(null);
|
|
2689
|
+
onCategoryClick?.();
|
|
2690
|
+
}
|
|
2691
|
+
};
|
|
2692
|
+
if (!expanded) {
|
|
2693
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
2694
|
+
/* @__PURE__ */ jsx(
|
|
2695
|
+
TooltipTrigger,
|
|
2696
|
+
{
|
|
2697
|
+
role: "button",
|
|
2698
|
+
tabIndex: 0,
|
|
2699
|
+
onClick: handleToggle,
|
|
2700
|
+
onKeyDown: (e) => {
|
|
2701
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
2702
|
+
e.preventDefault();
|
|
2703
|
+
handleToggle();
|
|
2704
|
+
}
|
|
2705
|
+
},
|
|
2706
|
+
className: s.root(),
|
|
2707
|
+
children: /* @__PURE__ */ jsx("span", { className: s.icon(), children: icon })
|
|
2708
|
+
}
|
|
2709
|
+
),
|
|
2710
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "right", sideOffset: 8, children: label })
|
|
2711
|
+
] });
|
|
2712
|
+
}
|
|
2713
|
+
if (!hasItems) {
|
|
2714
|
+
const conteudo = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2715
|
+
/* @__PURE__ */ jsx("span", { className: s.icon(), children: icon }),
|
|
2716
|
+
/* @__PURE__ */ jsx("span", { className: cn(s.text(), styles.textFadeIn), children: label })
|
|
2717
|
+
] });
|
|
2718
|
+
if (href) {
|
|
2719
|
+
const linkProps = {
|
|
2720
|
+
href,
|
|
2721
|
+
className: s.root(),
|
|
2722
|
+
onClick: (e) => {
|
|
2723
|
+
if (!renderLink) {
|
|
2724
|
+
const prevent = shouldPreventNavigation({ href, hasHandler: true, event: e });
|
|
2725
|
+
if (prevent) e.preventDefault();
|
|
2726
|
+
}
|
|
2727
|
+
handleToggle();
|
|
2728
|
+
},
|
|
2729
|
+
"aria-current": selected ? "page" : void 0,
|
|
2730
|
+
children: conteudo
|
|
2731
|
+
};
|
|
2732
|
+
if (renderLink) return /* @__PURE__ */ jsx(Fragment, { children: renderLink(linkProps) });
|
|
2733
|
+
return /* @__PURE__ */ jsx("a", { ...linkProps });
|
|
2734
|
+
}
|
|
2735
|
+
return /* @__PURE__ */ jsx("button", { type: "button", onClick: handleToggle, className: s.root(), children: conteudo });
|
|
2736
|
+
}
|
|
2737
|
+
return /* @__PURE__ */ jsxs(
|
|
2738
|
+
Collapsible,
|
|
2739
|
+
{
|
|
2740
|
+
open: isOpen,
|
|
2741
|
+
onOpenChange: (open) => {
|
|
2742
|
+
setOpenCategoryId(open ? id : null);
|
|
2743
|
+
onCategoryClick?.();
|
|
2744
|
+
},
|
|
2745
|
+
children: [
|
|
2746
|
+
/* @__PURE__ */ jsxs(CollapsibleTrigger, { className: s.root(), children: [
|
|
2747
|
+
/* @__PURE__ */ jsx("span", { className: s.icon(), children: icon }),
|
|
2748
|
+
/* @__PURE__ */ jsx("span", { className: cn(s.text(), styles.textFadeIn), children: label }),
|
|
2749
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: cn(s.chevron(), isOpen && "rotate-180") })
|
|
2750
|
+
] }),
|
|
2751
|
+
/* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("div", { className: styles.subItemList, children: items.map((item) => /* @__PURE__ */ jsx(
|
|
2752
|
+
SingleMenuItem,
|
|
2753
|
+
{
|
|
2754
|
+
label: item.label,
|
|
2755
|
+
selected: item.id === activeItemId,
|
|
2756
|
+
href: item.href,
|
|
2757
|
+
renderLink,
|
|
2758
|
+
interceptNavigation: !!onItemClick,
|
|
2759
|
+
onClick: () => onItemClick?.(item.id)
|
|
2760
|
+
},
|
|
2761
|
+
item.id
|
|
2762
|
+
)) }) })
|
|
2763
|
+
]
|
|
2764
|
+
}
|
|
2765
|
+
);
|
|
2766
|
+
}
|
|
2767
|
+
SingleMenuCategory.displayName = "SingleMenuCategory";
|
|
2768
|
+
function SingleMenuFooter({
|
|
2769
|
+
name,
|
|
2770
|
+
email,
|
|
2771
|
+
avatar,
|
|
2772
|
+
actions,
|
|
2773
|
+
onAction
|
|
2774
|
+
}) {
|
|
2775
|
+
const { expanded } = useSingleMenuSidebar();
|
|
2776
|
+
const s = styles.footer;
|
|
2777
|
+
const triggerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2778
|
+
/* @__PURE__ */ jsx("div", { className: s.avatar, children: avatar ?? /* @__PURE__ */ jsx(User, { className: s.avatarIcon }) }),
|
|
2779
|
+
expanded && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2780
|
+
/* @__PURE__ */ jsxs("div", { className: s.textContainer, children: [
|
|
2781
|
+
/* @__PURE__ */ jsx("span", { className: s.name, children: name }),
|
|
2782
|
+
/* @__PURE__ */ jsx("span", { className: s.email, children: email })
|
|
2783
|
+
] }),
|
|
2784
|
+
/* @__PURE__ */ jsx(ChevronsUpDown, { className: s.chevron })
|
|
2785
|
+
] })
|
|
2786
|
+
] });
|
|
2787
|
+
if (!actions || actions.length === 0) {
|
|
2788
|
+
return /* @__PURE__ */ jsx("div", { className: s.wrapper, children: /* @__PURE__ */ jsx("div", { className: cn(s.button, !expanded && "justify-center px-0"), children: triggerContent }) });
|
|
2789
|
+
}
|
|
2790
|
+
return /* @__PURE__ */ jsx("div", { className: s.wrapper, children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
2791
|
+
/* @__PURE__ */ jsx(
|
|
2792
|
+
DropdownMenuTrigger,
|
|
2793
|
+
{
|
|
2794
|
+
className: cn(s.button, !expanded && "justify-center px-0"),
|
|
2795
|
+
children: triggerContent
|
|
2796
|
+
}
|
|
2797
|
+
),
|
|
2798
|
+
/* @__PURE__ */ jsxs(
|
|
2799
|
+
DropdownMenuContent,
|
|
2800
|
+
{
|
|
2801
|
+
side: expanded ? "top" : "right",
|
|
2802
|
+
sideOffset: 8,
|
|
2803
|
+
align: expanded ? "end" : "start",
|
|
2804
|
+
children: [
|
|
2805
|
+
/* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsxs(DropdownMenuLabel, { className: s.dropdownLabel, children: [
|
|
2806
|
+
/* @__PURE__ */ jsx("span", { className: s.dropdownLabelName, children: name }),
|
|
2807
|
+
/* @__PURE__ */ jsx("span", { className: s.dropdownLabelEmail, children: email })
|
|
2808
|
+
] }) }),
|
|
2809
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
2810
|
+
actions.map((action) => /* @__PURE__ */ jsxs(
|
|
2811
|
+
DropdownMenuItem,
|
|
2812
|
+
{
|
|
2813
|
+
variant: action.variant === "destructive" ? "destructive" : "default",
|
|
2814
|
+
onClick: () => onAction?.(action.id),
|
|
2815
|
+
className: s.dropdownItem,
|
|
2816
|
+
children: [
|
|
2817
|
+
action.icon && /* @__PURE__ */ jsx("span", { className: s.dropdownItemIcon, children: action.icon }),
|
|
2818
|
+
/* @__PURE__ */ jsx("span", { children: action.label })
|
|
2819
|
+
]
|
|
2820
|
+
},
|
|
2821
|
+
action.id
|
|
2822
|
+
))
|
|
2823
|
+
]
|
|
2824
|
+
}
|
|
2825
|
+
)
|
|
2826
|
+
] }) });
|
|
2827
|
+
}
|
|
2828
|
+
SingleMenuFooter.displayName = "SingleMenuFooter";
|
|
2829
|
+
function SingleMenuSidebar({
|
|
2830
|
+
logo,
|
|
2831
|
+
title,
|
|
2832
|
+
module,
|
|
2833
|
+
modules,
|
|
2834
|
+
activeModuleId,
|
|
2835
|
+
defaultModuleId,
|
|
2836
|
+
onModuleChange,
|
|
2837
|
+
showSearch = true,
|
|
2838
|
+
searchPlaceholder,
|
|
2839
|
+
searchCommand,
|
|
2840
|
+
categories,
|
|
2841
|
+
activeItemId,
|
|
2842
|
+
onItemClick,
|
|
2843
|
+
renderLink,
|
|
2844
|
+
user,
|
|
2845
|
+
defaultExpanded = true,
|
|
2846
|
+
expanded: controlledExpanded,
|
|
2847
|
+
onExpandedChange,
|
|
2848
|
+
showToggleIndicator = false,
|
|
2849
|
+
className,
|
|
2850
|
+
...props
|
|
2851
|
+
}) {
|
|
2852
|
+
const {
|
|
2853
|
+
expanded,
|
|
2854
|
+
isHoverExpand,
|
|
2855
|
+
toggle,
|
|
2856
|
+
onMouseEnter,
|
|
2857
|
+
onMouseLeave,
|
|
2858
|
+
openCategoryId,
|
|
2859
|
+
setOpenCategoryId
|
|
2860
|
+
} = useSingleMenuSidebarState(
|
|
2861
|
+
defaultExpanded,
|
|
2862
|
+
controlledExpanded,
|
|
2863
|
+
onExpandedChange
|
|
2864
|
+
);
|
|
2865
|
+
const hasModules = !!modules && modules.length > 0;
|
|
2866
|
+
const [internalModuleId, setInternalModuleId] = useState(
|
|
2867
|
+
defaultModuleId ?? modules?.[0]?.id
|
|
2868
|
+
);
|
|
2869
|
+
const currentModuleId = activeModuleId ?? internalModuleId;
|
|
2870
|
+
const activeModule = hasModules ? modules.find((m) => m.id === currentModuleId) ?? modules[0] : void 0;
|
|
2871
|
+
const handleModuleChange = (id) => {
|
|
2872
|
+
if (activeModuleId === void 0) setInternalModuleId(id);
|
|
2873
|
+
onModuleChange?.(id);
|
|
2874
|
+
};
|
|
2875
|
+
const moduleDisplay = hasModules ? {
|
|
2876
|
+
icon: activeModule.icon,
|
|
2877
|
+
title: activeModule.title,
|
|
2878
|
+
subtitle: activeModule.subtitle ?? "",
|
|
2879
|
+
options: modules.map((m) => ({
|
|
2880
|
+
id: m.id,
|
|
2881
|
+
label: m.title,
|
|
2882
|
+
icon: m.icon
|
|
2883
|
+
})),
|
|
2884
|
+
onModuleChange: handleModuleChange
|
|
2885
|
+
} : module;
|
|
2886
|
+
const effectiveCategories = hasModules ? activeModule.categories : categories ?? [];
|
|
2887
|
+
const [commandOpen, setCommandOpen] = useState(false);
|
|
2888
|
+
useEffect(() => {
|
|
2889
|
+
if (!showSearch) return;
|
|
2890
|
+
const onKey = (e) => {
|
|
2891
|
+
if (e.key.toLowerCase() === "k" && (e.metaKey || e.ctrlKey)) {
|
|
2892
|
+
e.preventDefault();
|
|
2893
|
+
setCommandOpen((o) => !o);
|
|
2894
|
+
}
|
|
2895
|
+
};
|
|
2896
|
+
document.addEventListener("keydown", onKey);
|
|
2897
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
2898
|
+
}, [showSearch]);
|
|
2899
|
+
const selectFromSearch = (id, parentId) => {
|
|
2900
|
+
onItemClick?.(id);
|
|
2901
|
+
setOpenCategoryId(parentId ?? null);
|
|
2902
|
+
};
|
|
2903
|
+
const resolvedOpenCategoryId = openCategoryId ?? effectiveCategories.find(
|
|
2904
|
+
(cat) => cat.items?.some((item) => item.id === activeItemId)
|
|
2905
|
+
)?.id ?? null;
|
|
2906
|
+
const contextValue = useMemo(
|
|
2907
|
+
() => ({
|
|
2908
|
+
expanded,
|
|
2909
|
+
isHoverExpand,
|
|
2910
|
+
toggle,
|
|
2911
|
+
openCategoryId: resolvedOpenCategoryId,
|
|
2912
|
+
setOpenCategoryId
|
|
2913
|
+
}),
|
|
2914
|
+
[
|
|
2915
|
+
expanded,
|
|
2916
|
+
isHoverExpand,
|
|
2917
|
+
toggle,
|
|
2918
|
+
resolvedOpenCategoryId,
|
|
2919
|
+
setOpenCategoryId
|
|
2920
|
+
]
|
|
2921
|
+
);
|
|
2922
|
+
return /* @__PURE__ */ jsxs(SingleMenuSidebarContext.Provider, { value: contextValue, children: [
|
|
2923
|
+
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs(
|
|
2924
|
+
"aside",
|
|
2925
|
+
{
|
|
2926
|
+
"aria-label": "Navegação lateral",
|
|
2927
|
+
className: cn(sidebarRoot({ expanded }), className),
|
|
2928
|
+
onMouseEnter,
|
|
2929
|
+
onMouseLeave,
|
|
2930
|
+
...props,
|
|
2931
|
+
children: [
|
|
2932
|
+
/* @__PURE__ */ jsx(
|
|
2933
|
+
SingleMenuHeader,
|
|
2934
|
+
{
|
|
2935
|
+
logo,
|
|
2936
|
+
title,
|
|
2937
|
+
showToggleIndicator
|
|
2938
|
+
}
|
|
2939
|
+
),
|
|
2940
|
+
/* @__PURE__ */ jsx("div", { className: styles.divider }),
|
|
2941
|
+
expanded && (moduleDisplay || showSearch) && /* @__PURE__ */ jsxs("div", { className: cn(styles.sectionPadding, styles.textFadeIn), children: [
|
|
2942
|
+
moduleDisplay && /* @__PURE__ */ jsx(SingleMenuModuleSelector, { ...moduleDisplay }),
|
|
2943
|
+
showSearch && /* @__PURE__ */ jsx(
|
|
2944
|
+
SingleMenuSearch,
|
|
2945
|
+
{
|
|
2946
|
+
placeholder: searchPlaceholder,
|
|
2947
|
+
onOpen: () => setCommandOpen(true)
|
|
2948
|
+
}
|
|
2949
|
+
)
|
|
2950
|
+
] }),
|
|
2951
|
+
expanded && /* @__PURE__ */ jsx("div", { className: styles.divider }),
|
|
2952
|
+
/* @__PURE__ */ jsx(
|
|
2953
|
+
"nav",
|
|
2954
|
+
{
|
|
2955
|
+
className: cn(
|
|
2956
|
+
styles.navContainer,
|
|
2957
|
+
expanded ? styles.navContainerExpanded : styles.navContainerCollapsed
|
|
2958
|
+
),
|
|
2959
|
+
children: /* @__PURE__ */ jsx("div", { className: styles.navList, children: effectiveCategories.map((cat) => /* @__PURE__ */ jsx(
|
|
2960
|
+
SingleMenuCategory,
|
|
2961
|
+
{
|
|
2962
|
+
...cat,
|
|
2963
|
+
activeItemId,
|
|
2964
|
+
onItemClick,
|
|
2965
|
+
renderLink
|
|
2966
|
+
},
|
|
2967
|
+
cat.id
|
|
2968
|
+
)) })
|
|
2969
|
+
}
|
|
2970
|
+
),
|
|
2971
|
+
/* @__PURE__ */ jsx(SingleMenuFooter, { ...user })
|
|
2972
|
+
]
|
|
2973
|
+
}
|
|
2974
|
+
) }),
|
|
2975
|
+
showSearch && /* @__PURE__ */ jsx(
|
|
2976
|
+
SingleMenuCommand,
|
|
2977
|
+
{
|
|
2978
|
+
open: commandOpen,
|
|
2979
|
+
onOpenChange: setCommandOpen,
|
|
2980
|
+
categories: effectiveCategories,
|
|
2981
|
+
placeholder: searchPlaceholder,
|
|
2982
|
+
onSelect: selectFromSearch,
|
|
2983
|
+
custom: searchCommand
|
|
2984
|
+
}
|
|
2985
|
+
)
|
|
2986
|
+
] });
|
|
2987
|
+
}
|
|
2988
|
+
SingleMenuSidebar.displayName = "SingleMenuSidebar";
|
|
2243
2989
|
function deriveInitials(name) {
|
|
2244
2990
|
return name.split(" ").filter(Boolean).map((p) => p[0]).join("").slice(0, 2).toUpperCase();
|
|
2245
2991
|
}
|
|
@@ -2374,10 +3120,17 @@ function UserMenu({
|
|
|
2374
3120
|
}
|
|
2375
3121
|
const root = tv({
|
|
2376
3122
|
base: [
|
|
2377
|
-
"flex
|
|
3123
|
+
"flex w-full bg-bg-canvas",
|
|
2378
3124
|
"overflow-hidden"
|
|
2379
|
-
// garante que sidebar + main não vazem
|
|
2380
|
-
]
|
|
3125
|
+
// garante que sidebar + main não vazem o container
|
|
3126
|
+
],
|
|
3127
|
+
variants: {
|
|
3128
|
+
fillHeight: {
|
|
3129
|
+
false: "h-screen",
|
|
3130
|
+
true: "h-full"
|
|
3131
|
+
}
|
|
3132
|
+
},
|
|
3133
|
+
defaultVariants: { fillHeight: false }
|
|
2381
3134
|
});
|
|
2382
3135
|
const main = tv({
|
|
2383
3136
|
base: [
|
|
@@ -2419,47 +3172,60 @@ const bodyInner = tv({
|
|
|
2419
3172
|
mobileEdgeToEdge: false
|
|
2420
3173
|
}
|
|
2421
3174
|
});
|
|
2422
|
-
function AppShell({
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
3175
|
+
function AppShell(props) {
|
|
3176
|
+
const {
|
|
3177
|
+
// Sidebar
|
|
3178
|
+
contexts,
|
|
3179
|
+
defaultActiveContextId,
|
|
3180
|
+
activeContextId,
|
|
3181
|
+
onContextChange,
|
|
3182
|
+
defaultActiveItemHref,
|
|
3183
|
+
activeItemHref,
|
|
3184
|
+
onItemClick,
|
|
3185
|
+
renderLink,
|
|
3186
|
+
brandHref,
|
|
3187
|
+
onBrandClick,
|
|
3188
|
+
// Header
|
|
3189
|
+
breadcrumb,
|
|
3190
|
+
commandGroups,
|
|
3191
|
+
commandPlaceholder,
|
|
3192
|
+
commandEmptyMessage,
|
|
3193
|
+
searchPlaceholder,
|
|
3194
|
+
notifications,
|
|
3195
|
+
messages,
|
|
3196
|
+
theme,
|
|
3197
|
+
onThemeChange,
|
|
3198
|
+
themeOptions,
|
|
3199
|
+
headerRightSlot,
|
|
3200
|
+
// User menu
|
|
3201
|
+
user,
|
|
3202
|
+
layout,
|
|
3203
|
+
onLayoutChange,
|
|
3204
|
+
layoutOptions,
|
|
3205
|
+
onSettings,
|
|
3206
|
+
onLogout,
|
|
3207
|
+
// Menu collapse (controlled/uncontrolled)
|
|
3208
|
+
menuCollapsed: controlledCollapsed,
|
|
3209
|
+
defaultMenuCollapsed,
|
|
3210
|
+
onMenuCollapseChange,
|
|
3211
|
+
// Body
|
|
3212
|
+
children,
|
|
3213
|
+
bodyClassName,
|
|
3214
|
+
mobileEdgeToEdge,
|
|
3215
|
+
fillHeight,
|
|
3216
|
+
// Escolha da sidebar. SEM default aqui: um default literal estreitaria o tipo pra
|
|
3217
|
+
// "menu" e o TS marcaria a comparação com "single" como morta (TS2367).
|
|
3218
|
+
sidebar,
|
|
3219
|
+
categories,
|
|
3220
|
+
sidebarLogo,
|
|
3221
|
+
sidebarTitle,
|
|
3222
|
+
activeItemId,
|
|
3223
|
+
onSidebarItemClick,
|
|
3224
|
+
sidebarModules,
|
|
3225
|
+
sidebarShowSearch,
|
|
3226
|
+
sidebarSearchPlaceholder,
|
|
3227
|
+
className
|
|
3228
|
+
} = props;
|
|
2463
3229
|
const [internalCollapsed, setInternalCollapsed] = useState(() => {
|
|
2464
3230
|
if (defaultMenuCollapsed !== void 0) return defaultMenuCollapsed;
|
|
2465
3231
|
if (typeof window === "undefined") return false;
|
|
@@ -2491,37 +3257,73 @@ function AppShell({
|
|
|
2491
3257
|
onLogout
|
|
2492
3258
|
}
|
|
2493
3259
|
) : void 0;
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
3260
|
+
const sidebarNode = sidebar === "single" ? /* @__PURE__ */ jsx(
|
|
3261
|
+
SingleMenuSidebar,
|
|
3262
|
+
{
|
|
3263
|
+
logo: sidebarLogo,
|
|
3264
|
+
title: sidebarTitle ?? "",
|
|
3265
|
+
categories,
|
|
3266
|
+
modules: sidebarModules,
|
|
3267
|
+
activeItemId,
|
|
3268
|
+
onItemClick: onSidebarItemClick,
|
|
3269
|
+
renderLink,
|
|
3270
|
+
showSearch: sidebarShowSearch ?? false,
|
|
3271
|
+
searchPlaceholder: sidebarSearchPlaceholder,
|
|
3272
|
+
expanded: isMobile ? mobileMenuOpen : !menuCollapsed,
|
|
3273
|
+
onExpandedChange: (next) => {
|
|
3274
|
+
if (isMobile) {
|
|
3275
|
+
setMobileMenuOpen(next);
|
|
3276
|
+
return;
|
|
3277
|
+
}
|
|
3278
|
+
const nextCollapsed = !next;
|
|
3279
|
+
if (controlledCollapsed === void 0) setInternalCollapsed(nextCollapsed);
|
|
3280
|
+
onMenuCollapseChange?.(nextCollapsed);
|
|
3281
|
+
},
|
|
3282
|
+
user: {
|
|
3283
|
+
name: user?.name ?? "",
|
|
3284
|
+
email: user?.email ?? "",
|
|
3285
|
+
actions: [
|
|
3286
|
+
...onSettings ? [{ id: "settings", label: "Configurações" }] : [],
|
|
3287
|
+
...onLogout ? [{ id: "logout", label: "Sair", variant: "destructive" }] : []
|
|
3288
|
+
],
|
|
3289
|
+
onAction: (id) => {
|
|
3290
|
+
if (id === "settings") onSettings?.();
|
|
3291
|
+
if (id === "logout") onLogout?.();
|
|
3292
|
+
}
|
|
2516
3293
|
}
|
|
2517
|
-
|
|
3294
|
+
}
|
|
3295
|
+
) : /* @__PURE__ */ jsx(
|
|
3296
|
+
MenuSidebar,
|
|
3297
|
+
{
|
|
3298
|
+
contexts,
|
|
3299
|
+
activeContextId,
|
|
3300
|
+
defaultActiveContextId,
|
|
3301
|
+
onContextChange,
|
|
3302
|
+
activeItemHref,
|
|
3303
|
+
defaultActiveItemHref,
|
|
3304
|
+
onItemClick,
|
|
3305
|
+
renderLink,
|
|
3306
|
+
brandHref,
|
|
3307
|
+
onBrandClick,
|
|
3308
|
+
user: userNode,
|
|
3309
|
+
panelCollapsed: menuCollapsed,
|
|
3310
|
+
onPanelCollapseChange: (next) => {
|
|
3311
|
+
if (controlledCollapsed === void 0) setInternalCollapsed(next);
|
|
3312
|
+
onMenuCollapseChange?.(next);
|
|
3313
|
+
},
|
|
3314
|
+
mobileOpen: mobileMenuOpen,
|
|
3315
|
+
onMobileOpenChange: setMobileMenuOpen
|
|
3316
|
+
}
|
|
3317
|
+
);
|
|
3318
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(root({ fillHeight: fillHeight ?? false }), className), children: [
|
|
3319
|
+
sidebarNode,
|
|
2518
3320
|
/* @__PURE__ */ jsxs("div", { className: main(), children: [
|
|
2519
3321
|
/* @__PURE__ */ jsx(
|
|
2520
3322
|
Header,
|
|
2521
3323
|
{
|
|
2522
3324
|
breadcrumb,
|
|
2523
|
-
onCollapseMenu: handleToggleMenu,
|
|
2524
|
-
menuCollapsed,
|
|
3325
|
+
onCollapseMenu: sidebar === "single" && !isMobile ? void 0 : handleToggleMenu,
|
|
3326
|
+
menuCollapsed: isMobile ? !mobileMenuOpen : menuCollapsed,
|
|
2525
3327
|
commandGroups,
|
|
2526
3328
|
commandPlaceholder,
|
|
2527
3329
|
commandEmptyMessage,
|
|
@@ -2629,14 +3431,15 @@ export {
|
|
|
2629
3431
|
SidebarRail as k,
|
|
2630
3432
|
SidebarSection as l,
|
|
2631
3433
|
SidebarSubgroup as m,
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
3434
|
+
SingleMenuSidebar as n,
|
|
3435
|
+
chipCount as o,
|
|
3436
|
+
chipVariants as p,
|
|
3437
|
+
isExternalHref as q,
|
|
3438
|
+
isHashHref as r,
|
|
3439
|
+
isModifiedClick as s,
|
|
3440
|
+
shouldPreventNavigation as t,
|
|
2639
3441
|
useTheme as u,
|
|
2640
|
-
|
|
3442
|
+
useControllable as v,
|
|
3443
|
+
useMediaQuery as w
|
|
2641
3444
|
};
|
|
2642
|
-
//# sourceMappingURL=useTheme-
|
|
3445
|
+
//# sourceMappingURL=useTheme-B3ZakPqk.mjs.map
|