@fayz-ai/ui 0.10.1 → 0.11.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/analytics/AnalyticsCard.d.ts.map +1 -1
- package/dist/analytics/AnalyticsControls.d.ts.map +1 -1
- package/dist/analytics/batch.d.ts +19 -0
- package/dist/analytics/batch.d.ts.map +1 -0
- package/dist/analytics/context.d.ts.map +1 -1
- package/dist/analytics/index.d.ts +2 -0
- package/dist/analytics/index.d.ts.map +1 -1
- package/dist/{chunk-I6CPKAOD.js → chunk-7BMXN7MP.js} +215 -99
- package/dist/chunk-7BMXN7MP.js.map +1 -0
- package/dist/{chunk-6V5MGYXH.js → chunk-JGJNRNQW.js} +142 -31
- package/dist/chunk-JGJNRNQW.js.map +1 -0
- package/dist/{chunk-H63TOSQ7.js → chunk-QSHA2Q27.js} +475 -134
- package/dist/chunk-QSHA2Q27.js.map +1 -0
- package/dist/{chunk-SEIY2F5F.js → chunk-XRDCYOND.js} +231 -41
- package/dist/chunk-XRDCYOND.js.map +1 -0
- package/dist/chunk-ZBQ772DU.js +17 -0
- package/dist/chunk-ZBQ772DU.js.map +1 -0
- package/dist/dashboard/ChartWidget.d.ts.map +1 -1
- package/dist/dashboard/KpiCard.d.ts.map +1 -1
- package/dist/dashboard/SidebarOnboarding.d.ts +16 -11
- package/dist/dashboard/SidebarOnboarding.d.ts.map +1 -1
- package/dist/dashboard/Sparkline.d.ts +13 -0
- package/dist/dashboard/Sparkline.d.ts.map +1 -0
- package/dist/dashboard/index.d.ts +1 -0
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +3 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +234 -115
- package/dist/index.js.map +1 -1
- package/dist/layout/AppShell.d.ts +4 -1
- package/dist/layout/AppShell.d.ts.map +1 -1
- package/dist/layout/AppShellSkeleton.d.ts +23 -0
- package/dist/layout/AppShellSkeleton.d.ts.map +1 -0
- package/dist/layout/ModulePage.d.ts +5 -1
- package/dist/layout/ModulePage.d.ts.map +1 -1
- package/dist/layout/Sidebar.d.ts +19 -1
- package/dist/layout/Sidebar.d.ts.map +1 -1
- package/dist/layout/Topbar.d.ts +4 -1
- package/dist/layout/Topbar.d.ts.map +1 -1
- package/dist/layout/index.d.ts +2 -0
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +2 -1
- package/dist/layout/page-trail.d.ts +23 -0
- package/dist/layout/page-trail.d.ts.map +1 -0
- package/dist/layout/rail-flyout.d.ts +39 -0
- package/dist/layout/rail-flyout.d.ts.map +1 -0
- package/dist/primitives/bulk-action-bar.d.ts +30 -0
- package/dist/primitives/bulk-action-bar.d.ts.map +1 -0
- package/dist/primitives/checkbox.d.ts +5 -0
- package/dist/primitives/checkbox.d.ts.map +1 -1
- package/dist/primitives/data-table.d.ts +11 -1
- package/dist/primitives/data-table.d.ts.map +1 -1
- package/dist/primitives/dropdown.d.ts.map +1 -1
- package/dist/primitives/index.d.ts +4 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +2 -2
- package/dist/primitives/list-chrome.d.ts +20 -0
- package/dist/primitives/list-chrome.d.ts.map +1 -0
- package/dist/primitives/modal.d.ts.map +1 -1
- package/dist/primitives/phone-field.d.ts +19 -0
- package/dist/primitives/phone-field.d.ts.map +1 -0
- package/dist/primitives/search-select.d.ts +6 -1
- package/dist/primitives/search-select.d.ts.map +1 -1
- package/dist/primitives/thumbnail.d.ts +19 -0
- package/dist/primitives/thumbnail.d.ts.map +1 -0
- package/dist/styles.css +111 -1
- package/dist/tailwind.cjs +7 -2
- package/dist/tailwind.cjs.map +1 -1
- package/dist/tailwind.d.ts.map +1 -1
- package/dist/tailwind.js +7 -2
- package/dist/tailwind.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-6V5MGYXH.js.map +0 -1
- package/dist/chunk-H63TOSQ7.js.map +0 -1
- package/dist/chunk-I6CPKAOD.js.map +0 -1
- package/dist/chunk-SEIY2F5F.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/layout/rail-flyout.tsx","../src/layout/Sidebar.tsx","../src/layout/Topbar.tsx","../src/layout/AppShell.tsx","../src/layout/AppShellSkeleton.tsx","../src/layout/PageTransition.tsx","../src/layout/ModulePage.tsx","../src/layout/page-trail.tsx","../src/layout/ContentSplit.tsx"],"names":["content","useIsomorphicLayoutEffect","React2","jsxs","Fragment","jsx","ExternalLink","Crown","React3","Settings","ICON_MAP","Home","Bell","Search","ChevronDown","getIcon","React4","Menu","Receipt","ArrowLeftRight","Calendar","CreditCard","MessageCircle","Wallet","Plus","React5","React6","NavItem","ChevronRight","React7","React8"],"mappings":";;;;;;;;;;;AAuDA,IAAM,SAAA,GAAY,CAAA;AAClB,IAAM,cAAA,GAAiB,GAAA;AAGvB,IAAM,yBAAA,GACJ,OAAO,MAAA,KAAW,WAAA,GAAoB,KAAA,CAAA,eAAA,GAAwB,KAAA,CAAA,SAAA;AAEhE,SAAS,OAAO,IAAA,EAAkC;AAChD,EAAA,IAAI,CAAC,MAAM,OAAO,IAAA;AAClB,EAAA,OAAO,QAAA,CAAS,IAAI,CAAA,IAAK,IAAA;AAC3B;AAEO,SAAS,aAAA,CAAc;AAAA,EAC5B,OAAA;AAAA,EACA,OAAA;AAAA,EACA,WAAA;AAAA,EACA;AACF,CAAA,EAKqB;AACnB,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAU,eAAqE,IAAI,CAAA;AACzG,EAAA,MAAM,CAAC,GAAA,EAAK,MAAM,CAAA,GAAU,KAAA,CAAA,QAAA,CAAS,EAAE,GAAA,EAAK,CAAA,EAAG,KAAA,EAAO,EAAA,EAAI,CAAA;AAG1D,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAU,eAAS,KAAK,CAAA;AAClD,EAAA,MAAM,QAAA,GAAiB,aAAuB,IAAI,CAAA;AACl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KAAK,OAAO,IAAA;AACjB,EAAA,uBACE3B,IAAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,OAAA,EAAQ,SAAA;AAAA,MACR,IAAA,EAAK,IAAA;AAAA,MACL,OAAA,EAAS,MAAM,GAAA,CAAI,OAAA,CAAQ,IAAI,CAAA;AAAA,MAC/B,SAAA,EAAW,EAAA,CAAG,WAAA,EAAa,SAAS,CAAA;AAAA,MACpC,YAAA,EAAY,OAAO,KAAA,KAAU,QAAA,GAAW,KAAA,GAAQ,MAAA;AAAA,MAEhD,QAAA,EAAA;AAAA,wBAAAE,GAAAA,CAAC,cAAW,SAAA,EAAW,EAAA,CAAG,WAAW,CAAC,QAAA,IAAY,QAAQ,CAAA,EAAG,CAAA;AAAA,QAC5D,CAAC,QAAA,IAAY;AAAA;AAAA;AAAA,GAChB;AAEJ","file":"chunk-QSHA2Q27.js","sourcesContent":["import * as React from 'react'\nimport { ChevronRight, Crown, ExternalLink, type LucideIcon } from 'lucide-react'\nimport { ICON_MAP } from '../icons'\nimport { cn } from '../lib/cn'\n\n// ---------------------------------------------------------------------------\n// Rail flyout — what the collapsed sidebar says when you point at it.\n//\n// One panel for the WHOLE rail, not one tooltip per row: it slides down the\n// rail to whichever item the pointer is on and swaps its contents on arrival,\n// so running down the menu reads as a single object following you instead of a\n// dozen bubbles blinking in and out. It also carries the item's children, which\n// a tooltip could not — a collapsed rail otherwise hides every sub-link behind\n// a click.\n//\n// The panel is painted in the SIDEBAR's tone (not the popover's): it is the\n// menu speaking, and a white card on a dark rail read as a foreign surface.\n// ---------------------------------------------------------------------------\n\nexport interface RailFlyoutEntry {\n id: string\n label: string\n icon?: string\n route?: string\n href?: string\n premium?: boolean\n badge?: string | number\n}\n\nexport interface RailFlyoutContent {\n /** Identity of the anchored item — a change is what triggers the swap. */\n key: string\n label: string\n route?: string\n href?: string\n premium?: boolean\n badge?: string | number\n entries?: RailFlyoutEntry[]\n}\n\nexport interface RailFlyoutHandle {\n /** Props to spread on a collapsed row so it anchors the panel. */\n rowProps: (content: RailFlyoutContent) => {\n onMouseEnter: (event: React.MouseEvent<HTMLElement>) => void\n onFocus: (event: React.FocusEvent<HTMLElement>) => void\n onMouseLeave: () => void\n }\n /** Rendered by the rail, as a sibling of its scrolling nav. */\n panel: React.ReactNode\n /** Close now (navigation, Escape, focus leaving the rail). */\n dismiss: () => void\n}\n\n/** Gap between the rail's edge and the panel — also the pointer's bridge, so\n * moving diagonally from the icon into the panel never crosses dead space. */\nconst GUTTER_PX = 8\nconst CLOSE_DELAY_MS = 140\n\n/** Layout effect on the client, plain effect during SSR (avoids the warning). */\nconst useIsomorphicLayoutEffect =\n typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\nfunction iconOf(name?: string): LucideIcon | null {\n if (!name) return null\n return ICON_MAP[name] ?? null\n}\n\nexport function useRailFlyout({\n enabled,\n railRef,\n activeRoute,\n onNavigate,\n}: {\n enabled: boolean\n railRef: React.RefObject<HTMLElement | null>\n activeRoute?: string | null\n onNavigate: (route: string) => void\n}): RailFlyoutHandle {\n const [state, setState] = React.useState<{ anchor: HTMLElement; content: RailFlyoutContent } | null>(null)\n const [pos, setPos] = React.useState({ top: 0, arrow: 20 })\n // Transitions are off while the panel is hidden: the first appearance would\n // otherwise fly in from wherever the previous item left it.\n const [animate, setAnimate] = React.useState(false)\n const panelRef = React.useRef<HTMLDivElement>(null)\n const closeTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null)\n // Held so the panel can fade OUT still showing what it was showing.\n const lastContent = React.useRef<RailFlyoutContent | null>(null)\n\n const cancelClose = React.useCallback(() => {\n if (closeTimer.current) {\n clearTimeout(closeTimer.current)\n closeTimer.current = null\n }\n }, [])\n\n const show = React.useCallback(\n (anchor: HTMLElement, content: RailFlyoutContent) => {\n if (!enabled) return\n cancelClose()\n setState({ anchor, content })\n },\n [enabled, cancelClose],\n )\n\n const hide = React.useCallback(() => {\n cancelClose()\n closeTimer.current = setTimeout(() => setState(null), CLOSE_DELAY_MS)\n }, [cancelClose])\n\n const dismiss = React.useCallback(() => {\n cancelClose()\n setState(null)\n }, [cancelClose])\n\n React.useEffect(() => () => cancelClose(), [cancelClose])\n\n // Anything that isn't the rail anymore closes it: leaving the enabled state\n // (rail expanded) would otherwise strand an open panel over the content.\n React.useEffect(() => {\n if (!enabled) dismiss()\n }, [enabled, dismiss])\n\n // Position: aligned with the row, clamped so a long child list can't hang off\n // the top or bottom of the rail. The arrow keeps pointing at the row even\n // after the clamp moved the panel away from it.\n const reposition = React.useCallback(() => {\n const rail = railRef.current\n const anchor = state?.anchor\n if (!rail || !anchor) return\n const railRect = rail.getBoundingClientRect()\n const rect = anchor.getBoundingClientRect()\n const height = panelRef.current?.offsetHeight ?? 0\n const rowTop = rect.top - railRect.top\n const rowCenter = rowTop + rect.height / 2\n const max = Math.max(GUTTER_PX, railRect.height - height - GUTTER_PX)\n const top = Math.min(Math.max(GUTTER_PX, rowTop - 6), max)\n const arrow = Math.min(Math.max(rowCenter - top, 14), Math.max(14, height - 14))\n setPos({ top, arrow })\n }, [railRef, state])\n\n useIsomorphicLayoutEffect(reposition, [reposition, state?.content.key])\n\n // The rail scrolls under the panel: without this the panel stays pinned where\n // the row USED to be, which is the one thing a follower must never do.\n React.useEffect(() => {\n if (!state) return\n const rail = railRef.current\n const onScroll = () => reposition()\n rail?.addEventListener('scroll', onScroll, true)\n window.addEventListener('resize', onScroll)\n return () => {\n rail?.removeEventListener('scroll', onScroll, true)\n window.removeEventListener('resize', onScroll)\n }\n }, [state, railRef, reposition])\n\n const visible = !!state\n React.useEffect(() => {\n if (!visible) {\n setAnimate(false)\n return\n }\n const id = requestAnimationFrame(() => setAnimate(true))\n return () => cancelAnimationFrame(id)\n }, [visible])\n\n React.useEffect(() => {\n if (!visible) return\n const onKey = (event: KeyboardEvent) => {\n if (event.key === 'Escape') dismiss()\n }\n window.addEventListener('keydown', onKey)\n return () => window.removeEventListener('keydown', onKey)\n }, [visible, dismiss])\n\n const rowProps = React.useCallback(\n (content: RailFlyoutContent) => ({\n onMouseEnter: (event: React.MouseEvent<HTMLElement>) => show(event.currentTarget, content),\n onFocus: (event: React.FocusEvent<HTMLElement>) => show(event.currentTarget, content),\n onMouseLeave: hide,\n }),\n [show, hide],\n )\n\n if (state) lastContent.current = state.content\n const content = state?.content ?? lastContent.current\n\n const go = (entry: { route?: string; href?: string }) => {\n dismiss()\n if (entry.href) {\n window.open(entry.href, '_blank', 'noopener,noreferrer')\n return\n }\n if (entry.route) onNavigate(entry.route)\n }\n\n const entries = content?.entries ?? []\n const hasEntries = entries.length > 0\n\n const panel = enabled ? (\n <div\n // Outside the scrolling nav on purpose: inside it, the panel would be\n // clipped at the rail's 4rem edge and scroll away from its own anchor.\n style={{ transform: `translateY(${pos.top}px)`, paddingLeft: GUTTER_PX }}\n onMouseEnter={cancelClose}\n onMouseLeave={hide}\n className={cn(\n 'absolute left-full top-0 z-50 hidden md:block',\n animate && 'motion-safe:transition-[transform,opacity] motion-safe:duration-200 motion-safe:ease-out',\n visible ? 'opacity-100' : 'pointer-events-none opacity-0',\n )}\n aria-hidden={!visible}\n >\n <div\n ref={panelRef}\n className={cn(\n // Sidebar tone, sidebar border: the panel is the menu leaning out,\n // not a popover from the page underneath it.\n 'relative rounded-lg border border-sidebar-border bg-sidebar p-1 text-sidebar-foreground shadow-xl shadow-black/25',\n hasEntries ? 'min-w-[12.5rem] max-w-[16rem]' : 'max-w-[15rem]',\n )}\n >\n {/* Notch — a rotated square sharing the panel's fill and border, with\n the two inner edges masked by the panel itself. */}\n <span\n aria-hidden\n style={{ top: pos.arrow }}\n className=\"absolute -left-[5px] h-2.5 w-2.5 -translate-y-1/2 rotate-45 border-b border-l border-sidebar-border bg-sidebar\"\n />\n <div key={content?.key} className=\"saas-flyout-swap\">\n {content && <FlyoutBody content={content} entries={entries} activeRoute={activeRoute} onGo={go} />}\n </div>\n </div>\n </div>\n ) : null\n\n return { rowProps, panel, dismiss }\n}\n\nfunction FlyoutBody({\n content,\n entries,\n activeRoute,\n onGo,\n}: {\n content: RailFlyoutContent\n entries: RailFlyoutEntry[]\n activeRoute?: string | null\n onGo: (entry: { route?: string; href?: string }) => void\n}) {\n const hasEntries = entries.length > 0\n const headerActive = !!content.route && content.route === activeRoute\n const headerClickable = !!content.route || !!content.href\n\n const header = (\n <div\n className={cn(\n 'flex items-center gap-2 rounded-md px-2 py-1.5 text-[13px] font-semibold',\n hasEntries ? 'text-sidebar-foreground' : 'whitespace-nowrap',\n headerActive && 'text-sidebar-accent-foreground',\n headerClickable && 'transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',\n )}\n >\n <span className=\"min-w-0 flex-1 truncate\">{content.label}</span>\n {content.href && <ExternalLink className=\"h-3 w-3 shrink-0 opacity-50\" aria-hidden />}\n {content.premium && <Crown className=\"h-3 w-3 shrink-0 text-amber-500\" aria-hidden />}\n {content.badge !== undefined && (\n <span className=\"rounded-full bg-primary px-1.5 py-0.5 text-[10px] font-semibold text-primary-foreground\">\n {content.badge}\n </span>\n )}\n {hasEntries && headerClickable && (\n <ChevronRight className=\"h-3 w-3 shrink-0 text-sidebar-muted\" aria-hidden />\n )}\n </div>\n )\n\n return (\n <>\n {headerClickable ? (\n <button type=\"button\" onClick={() => onGo(content)} className=\"w-full text-left\">\n {header}\n </button>\n ) : (\n header\n )}\n {hasEntries && (\n <>\n <div className=\"my-1 h-px bg-sidebar-border\" />\n <div className=\"flex flex-col\">\n {entries.map((entry) => {\n const EntryIcon = iconOf(entry.icon)\n const isActive = !!entry.route && entry.route === activeRoute\n return (\n <button\n key={entry.id}\n type=\"button\"\n onClick={() => onGo(entry)}\n className={cn(\n 'flex items-center gap-2 rounded-md px-2 py-1.5 text-[12.5px] transition-colors',\n isActive\n ? 'bg-sidebar-accent font-medium text-sidebar-accent-foreground'\n : 'text-sidebar-foreground/75 hover:bg-sidebar-accent/60 hover:text-sidebar-accent-foreground',\n )}\n >\n {EntryIcon && <EntryIcon className=\"h-3.5 w-3.5 shrink-0 opacity-70\" />}\n <span className=\"min-w-0 flex-1 truncate text-left\">{entry.label}</span>\n {entry.href && <ExternalLink className=\"h-3 w-3 shrink-0 opacity-50\" aria-hidden />}\n {entry.premium && <Crown className=\"h-3 w-3 shrink-0 text-amber-500\" aria-hidden />}\n {entry.badge !== undefined && (\n <span className=\"rounded-full bg-primary px-1.5 py-0.5 text-[10px] font-semibold text-primary-foreground\">\n {entry.badge}\n </span>\n )}\n </button>\n )\n })}\n </div>\n </>\n )}\n </>\n )\n}\n","import * as React from 'react'\nimport {\n Bell, ChevronDown, Crown, ExternalLink, Home, PanelLeft, PanelLeftClose, Search, Settings, User,\n type LucideIcon,\n} from 'lucide-react'\nimport { ICON_MAP } from '../icons'\nimport { cn } from '../lib/cn'\nimport { useLayoutStore } from '../stores/layout.store'\nimport { useRailFlyout, type RailFlyoutContent, type RailFlyoutHandle } from './rail-flyout'\n\nexport interface NavigationItem {\n id: string\n label: string\n icon: string\n route: string\n section: 'main' | 'secondary' | 'settings'\n /**\n * Heading this item sits under, WITHIN its section.\n *\n * `section` only ever offered two labelled runs, which is enough for an app\n * rail and not enough for the settings rail: a store console needs \"Loja\" and\n * \"Commerce\" as separate headings under the same section, and folding them\n * into main/secondary would spend the plugin run on one of them. Consecutive\n * items sharing a group render under one heading, in first-appearance order;\n * items with no group render first, headed by `sectionLabels`.\n */\n group?: string\n badge?: string | number\n permission?: { feature: string; action: 'read' | 'create' | 'edit' | 'delete' }\n /** Freemium discovery: the user's role allows this item, but their plan does\n * not entitle the feature. The item stays visible with a small Crown badge\n * and, on click, leads to the plan's UpgradePrompt. */\n premium?: boolean\n /** Sales-channel / external link: when set, the item opens this URL in a new\n * tab instead of navigating an internal route. Rendered as an anchor with an\n * external-link glyph. `route` is ignored for matching when `href` is set. */\n href?: string\n children?: NavigationItem[]\n}\n\nexport interface SidebarUser {\n fullName: string\n avatarUrl?: string\n email: string\n}\n\nexport interface SidebarProps {\n navigation: NavigationItem[]\n logo?: React.ReactNode\n collapsed: boolean\n onToggle: () => void\n onNavigate?: (route: string) => void\n currentPath?: string\n user?: SidebarUser\n onSignOut?: () => void\n onProfile?: () => void\n onSettings?: () => void\n onBilling?: () => void\n userMenuExtras?: { label: string; icon?: React.ReactNode; onClick: () => void }[]\n orgSwitcher?: React.ReactNode\n topContent?: React.ReactNode\n /** Pinned to the head of the nav list — INSIDE the part that swaps, so a\n * contextual rail's \"← back\" arrives and leaves with the links it belongs\n * to. `topContent` (the workspace) sits above and never moves. */\n navTop?: React.ReactNode\n footerContent?: React.ReactNode\n /** When true, removes all borders for a cleaner framed look */\n borderless?: boolean\n /** User menu component to render at the bottom */\n userMenuSlot?: React.ReactNode\n /** Notification slot to render at the bottom */\n notificationSlot?: React.ReactNode\n /** Unread notification count for the bell indicator */\n unreadCount?: number\n /** Placeholder on the rail's search field (\"Buscar\"). The shell passes the\n * translated word; the default keeps standalone mounts readable. */\n searchLabel?: string\n /** Optional headings above each nav section. Used by contextual sidebars\n * (e.g. /settings swaps the rail for \"Settings links\" + \"Plugins\"); the\n * normal app rail leaves them undefined and renders no headings. */\n sectionLabels?: { main?: string; secondary?: string; settings?: string }\n /** Identity of the current rail context. When it changes, the rail animates\n * as a push: the new nav slides in while the previous one slides out.\n * Leave undefined for a static rail (no swap animation). */\n navKey?: string\n /** Push direction for a `navKey` change. 'forward' pulls the new rail in\n * from the right (drilling in), 'back' from the left (returning). */\n navDirection?: 'forward' | 'back'\n /**\n * Render a group's children as bare labels with an elbow (↳) marking the\n * active one, instead of the icon-per-child list. Icons on children make a\n * group read as a second flat menu; the elbow says \"you are inside this one\"\n * with a single mark. Off by default — it changes every existing rail.\n */\n navChildConnector?: boolean\n}\n\n// ICON_MAP now lives in ../icons (central curated registry, shared by every\n// string-name icon lookup in the SDK); re-exported here for compat.\nexport { ICON_MAP }\n\n/** Kept in sync with --saas-rail-duration in styles.css. */\nconst RAIL_PUSH_MS = 260\n\n/** Layout effect on the client, plain effect during SSR (avoids the warning).\n * The rail push needs the layout variant: the animation classes must be on\n * the DOM before paint, or the new rail shows one frame at its final spot. */\nconst useIsomorphicLayoutEffect =\n typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\nfunction getIcon(name: string): LucideIcon {\n return ICON_MAP[name] ?? Home\n}\n\n/** \"⌘\" on a Mac, \"Ctrl \" everywhere else — the hint has to name the key the\n * reader actually has, or it is decoration. */\nfunction shortcutKey(): string {\n if (typeof navigator === 'undefined') return '⌘'\n return /Mac|iPhone|iPad/u.test(navigator.platform || navigator.userAgent) ? '⌘' : 'Ctrl '\n}\n\n/** What the collapsed rail hands the flyout for an item. */\nfunction flyoutContentOf(item: NavigationItem): RailFlyoutContent {\n return {\n key: item.id,\n label: item.label,\n route: item.route,\n href: item.href,\n premium: item.premium,\n badge: item.badge,\n entries: item.children?.map((child) => ({\n id: child.id,\n label: child.label,\n icon: child.icon,\n route: child.route,\n href: child.href,\n premium: child.premium,\n badge: child.badge,\n })),\n }\n}\n\nfunction NavItem({\n item,\n collapsed,\n isActive,\n onNavigate,\n flyout,\n}: {\n item: NavigationItem\n collapsed: boolean\n isActive: boolean\n onNavigate: (route: string) => void\n flyout?: RailFlyoutHandle\n}) {\n const Icon = getIcon(item.icon)\n const isExternal = !!item.href\n // Collapsed rail: the label (and any children) live in the shared flyout —\n // the rail itself shows nothing but the glyph.\n const hoverProps = collapsed && flyout ? flyout.rowProps(flyoutContentOf(item)) : undefined\n\n const className = cn(\n 'flex w-full items-center gap-3 rounded-button px-2.5 py-1.5 text-[13px] font-medium transition-colors',\n 'hover:bg-sidebar-accent/60 hover:text-sidebar-accent-foreground',\n isActive\n ? 'bg-sidebar-accent font-semibold text-sidebar-accent-foreground shadow-sm'\n : 'text-sidebar-foreground/80',\n collapsed && 'justify-center px-2',\n )\n\n const inner = (\n <>\n <Icon className=\"h-4 w-4 shrink-0\" />\n {!collapsed && (\n <>\n <span className=\"flex-1 truncate text-left\">{item.label}</span>\n {isExternal && (\n <ExternalLink className=\"ml-auto h-3.5 w-3.5 shrink-0 opacity-50\" aria-hidden />\n )}\n {item.premium && (\n <Crown className={cn('h-3.5 w-3.5 shrink-0 text-amber-500', !isExternal && 'ml-auto')} aria-hidden />\n )}\n {item.badge !== undefined && (\n <span className={cn('rounded-full bg-primary px-2 py-0.5 text-xs font-semibold text-primary-foreground', !isExternal && !item.premium && 'ml-auto')}>\n {item.badge}\n </span>\n )}\n </>\n )}\n </>\n )\n\n return isExternal ? (\n <a href={item.href} target=\"_blank\" rel=\"noopener noreferrer\" className={className} {...hoverProps}>\n {inner}\n </a>\n ) : (\n <button\n onClick={() => {\n flyout?.dismiss()\n onNavigate(item.route)\n }}\n className={className}\n {...hoverProps}\n >\n {inner}\n </button>\n )\n}\n\n/** How specifically `route` matches `path` (-1 = no match; higher = more specific).\n * An exact match beats a prefix match; a longer prefix beats a shorter one. */\nfunction routeMatchScore(route: string, path: string): number {\n if (path === route) return route.length + 1\n if (route !== '/' && path.startsWith(route + '/')) return route.length\n return -1\n}\n\n/** The single most-specific nav route that matches the current path (longest wins).\n * Prevents a parent like `/courses` from staying active on `/courses/sales`. */\nfunction resolveActiveRoute(navigation: NavigationItem[], path: string): string | null {\n let best: string | null = null\n let bestScore = 0\n const consider = (route?: string) => {\n if (!route) return\n const score = routeMatchScore(route, path)\n if (score > bestScore) { bestScore = score; best = route }\n }\n for (const item of navigation) {\n consider(item.route)\n for (const child of item.children ?? []) consider(child.route)\n }\n return best\n}\n\nfunction NavGroup({\n item,\n collapsed,\n activeRoute,\n onNavigate,\n childConnector,\n flyout,\n}: {\n item: NavigationItem\n collapsed: boolean\n activeRoute: string | null\n onNavigate: (route: string) => void\n childConnector?: boolean\n flyout?: RailFlyoutHandle\n}) {\n const isChildActive = item.children?.some((c) => c.route === activeRoute)\n const [open, setOpen] = React.useState(() => isChildActive ?? false)\n const Icon = getIcon(item.icon)\n\n if (collapsed) {\n // The children are the whole point of pointing at a group in a 4rem rail:\n // clicking through to the parent to discover them is a round trip the\n // pointer already paid for.\n const hoverProps = flyout?.rowProps(flyoutContentOf(item))\n return (\n <button\n onClick={() => {\n flyout?.dismiss()\n onNavigate(item.route)\n }}\n className={cn(\n 'flex w-full items-center justify-center rounded-button px-2 py-2 text-sm font-medium transition-colors',\n 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',\n isChildActive ? 'bg-sidebar-accent text-sidebar-accent-foreground' : 'text-sidebar-muted'\n )}\n {...hoverProps}\n >\n <Icon className=\"h-4 w-4 shrink-0\" />\n </button>\n )\n }\n\n return (\n <div>\n {/* Metrics and resting colour are NavItem's, deliberately: a group header\n and a plain link are peers in the rail, and rendering the group in\n text-sidebar-muted read as \"disabled\" next to its own siblings. */}\n <button\n onClick={() => setOpen(!open)}\n className={cn(\n 'flex w-full items-center gap-3 rounded-button px-2.5 py-1.5 text-[13px] font-medium transition-colors',\n 'hover:bg-sidebar-accent/60 hover:text-sidebar-accent-foreground',\n isChildActive ? 'text-sidebar-accent-foreground' : 'text-sidebar-foreground/80'\n )}\n >\n <Icon className=\"h-4 w-4 shrink-0\" />\n <span className=\"flex-1 truncate text-left\">{item.label}</span>\n <ChevronDown className={cn('h-3.5 w-3.5 shrink-0 transition-transform', open && 'rotate-180')} />\n </button>\n {open && (\n <div className={cn(\n 'mt-0.5',\n // Connector mode has no per-child icon and no running rule: the line\n // is DRAWN, from the parent down to the active child and curving into\n // it. Extra left padding reserves the column that line lives in.\n //\n // No row gap (space-y-*) here: the line is assembled from one segment\n // per row, so any gap between rows shows up as a break in what has to\n // read as a single continuous stroke. Rows carry a fixed h-8 instead,\n // which is also what makes the elbow's y=16 land on their centre.\n //\n // The indent lives on the ROWS, not here: the connector is positioned\n // from this box's left edge, so padding it would push the line right\n // along with the labels and land the arrowhead on top of the text.\n childConnector ? 'relative' : 'ml-4 space-y-0.5 border-l border-sidebar-border/50 pl-3',\n )}>\n {item.children?.map((child, childIndex) => {\n const ChildIcon = getIcon(child.icon)\n const isActive = child.route === activeRoute\n const childExternal = !!child.href\n const childClass = cn(\n 'flex w-full items-center rounded-button text-sm transition-colors',\n // pl-11 clears the connector (whose arrowhead ends at ~24px) with\n // room to spare, so the children read as one clearly indented\n // column rather than crowding the line that points at them.\n childConnector ? 'h-8 gap-0 pl-11 pr-1' : 'gap-2.5 px-2 py-1.5',\n isActive\n ? 'font-medium text-sidebar-accent-foreground'\n : 'text-sidebar-foreground/70 hover:text-sidebar-accent-foreground'\n )\n const childInner = (\n <>\n {childConnector ? null : <ChildIcon className=\"mr-2.5 h-3.5 w-3.5 shrink-0\" />}\n <span className=\"flex-1 truncate text-left\">{child.label}</span>\n {childExternal && (\n <ExternalLink className=\"h-3 w-3 shrink-0 opacity-50\" aria-hidden />\n )}\n {child.premium && (\n <Crown className=\"h-3 w-3 shrink-0 text-amber-500\" aria-hidden />\n )}\n </>\n )\n const row = childExternal ? (\n <a href={child.href} target=\"_blank\" rel=\"noopener noreferrer\" className={childClass}>\n {childInner}\n </a>\n ) : (\n <button onClick={() => onNavigate(child.route)} className={childClass}>\n {childInner}\n </button>\n )\n\n if (!childConnector) return <React.Fragment key={child.id}>{row}</React.Fragment>\n\n // The line runs from the parent down to the active child and stops\n // there, curving in with an arrowhead. Children ABOVE the active one\n // carry the straight segment; the active one carries the elbow;\n // below it, nothing — a rule continuing past the destination would\n // be drawing a relationship that doesn't point anywhere.\n const activeIndex = item.children!.findIndex((c) => c.route === activeRoute)\n const onPath = activeIndex >= 0 && childIndex < activeIndex\n // The straight segment is butt-ended (no rounded cap) and spans the\n // row edge to edge, so consecutive rows join into one unbroken line.\n return (\n // The connector's colour is set HERE, on the wrapper, and BOTH\n // halves inherit it: the straight segments and the elbow are one\n // line, so a different opacity on either makes the stroke change\n // shade halfway down. Weight matches too — the span is 1.5px wide\n // and the path is stroke-width 1.5 on the same 13.75px centre.\n //\n // Set on the wrapper rather than inherited from the row: rows dim\n // to /70 when inactive, and a line fading along with the label it\n // points AT was nearly invisible on a dark rail.\n <div key={child.id} className=\"relative h-8 text-sidebar-foreground/45\">\n {onPath && (\n <span\n aria-hidden\n className=\"pointer-events-none absolute bottom-0 left-[13px] top-0 w-[1.5px] bg-current\"\n />\n )}\n {isActive && (\n <svg\n aria-hidden\n className=\"pointer-events-none absolute left-1 top-0\"\n width=\"21\" height=\"32\" viewBox=\"0 0 21 32\" fill=\"none\"\n >\n {/* Down the same 9.75px column the segments use, then a\n quarter-turn into the label's vertical centre (y=16 of\n the 32px row). */}\n <path d=\"M9.75 0 V11 Q9.75 16 14.75 16 H20\"\n stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" fill=\"none\" />\n <path d=\"M17 13 L20 16 L17 19\"\n stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" fill=\"none\" />\n </svg>\n )}\n {row}\n </div>\n )\n })}\n </div>\n )}\n </div>\n )\n}\n\n/**\n * Hand a sidebar slot the collapsed state — but only if it can receive it.\n *\n * The slots are `React.ReactNode`, so a host may pass a component OR a plain\n * `<button>`. Cloning a DOM element with `{ collapsed }` puts the prop on the\n * tag, and React warns: *Received `false` for a non-boolean attribute*. That is\n * exactly what the settings back-link did — a bare `<button>`, so the warning\n * appeared only inside Configurações and nowhere else.\n *\n * `typeof type === 'string'` is a DOM tag; anything else is a component, which\n * may or may not use the prop but will not leak it to the DOM by accident.\n */\nfunction withCollapsed(slot: React.ReactNode, collapsed: boolean): React.ReactNode {\n if (!React.isValidElement(slot)) return slot\n if (typeof slot.type === 'string') return slot\n return React.cloneElement(slot as React.ReactElement<any>, { collapsed })\n}\n\nexport function Sidebar({\n navigation,\n logo,\n collapsed,\n onToggle,\n onNavigate,\n currentPath: currentPathProp = '/',\n user: _user,\n orgSwitcher,\n topContent,\n navTop,\n footerContent,\n borderless,\n userMenuSlot,\n notificationSlot,\n unreadCount = 0,\n searchLabel = 'Search',\n sectionLabels,\n navKey,\n navDirection = 'forward',\n navChildConnector,\n}: SidebarProps) {\n const currentPath = currentPathProp\n const setCommandPaletteOpen = useLayoutStore((s) => s.setCommandPaletteOpen)\n\n // Most-specific match wins, so sibling routes that share a prefix (e.g.\n // /courses vs /courses/sales) don't both light up.\n const activeRoute = resolveActiveRoute(navigation, currentPath)\n\n const railRef = React.useRef<HTMLElement | null>(null)\n const flyout = useRailFlyout({\n enabled: collapsed,\n railRef,\n activeRoute,\n onNavigate: (route) => onNavigate?.(route),\n })\n\n const mainItems = navigation.filter((item) => item.section === 'main')\n const secondaryItems = navigation.filter((item) => item.section === 'secondary')\n const settingsItems = navigation.filter((item) => item.section === 'settings')\n\n const handleNavigate = (route: string) => {\n onNavigate?.(route)\n }\n\n const sectionHeading = (label?: string) =>\n label && !collapsed ? (\n <p className=\"px-2.5 pb-1 pt-1 text-[10px] font-semibold uppercase tracking-wider text-sidebar-muted\">\n {label}\n </p>\n ) : null\n\n // Runs of consecutive items sharing a `group`, in first-appearance order. The\n // ungrouped run keeps `sectionLabels` as its heading, so a rail that declares\n // no groups renders byte-identically to before.\n const groupRuns = (items: NavigationItem[]): Array<{ group?: string; items: NavigationItem[] }> => {\n const runs: Array<{ group?: string; items: NavigationItem[] }> = []\n for (const item of items) {\n const last = runs[runs.length - 1]\n if (last && last.group === item.group) last.items.push(item)\n else runs.push({ group: item.group, items: [item] })\n }\n return runs\n }\n\n const renderSection = (items: NavigationItem[], label?: string) => {\n const runs = groupRuns(items)\n return runs.map((run, i) => (\n <div key={run.group ?? `ungrouped-${i}`} className={i === 0 ? 'space-y-1' : 'mt-6 space-y-1'}>\n {sectionHeading(run.group ?? label)}\n {run.items.map(renderItem)}\n </div>\n ))\n }\n\n const renderItem = (item: NavigationItem) =>\n item.children && item.children.length > 0 ? (\n <NavGroup key={item.id} item={item} collapsed={collapsed} activeRoute={activeRoute} onNavigate={handleNavigate} childConnector={navChildConnector} flyout={flyout} />\n ) : (\n <NavItem\n key={item.id}\n item={item}\n collapsed={collapsed}\n isActive={item.route === activeRoute}\n onNavigate={handleNavigate}\n flyout={flyout}\n />\n )\n\n // The swappable part of the rail (top slot + both nav sections). Kept as one\n // node so a context change can snapshot the outgoing rail and animate it out.\n const navBody = (\n <>\n {navTop && <div className=\"mb-2\">{withCollapsed(navTop, collapsed)}</div>}\n {mainItems.length > 0 && renderSection(mainItems, sectionLabels?.main)}\n {secondaryItems.length > 0 && (\n <div className=\"mt-6\">{renderSection(secondaryItems, sectionLabels?.secondary)}</div>\n )}\n </>\n )\n\n // Rail push: when `navKey` changes, hold the previous rail on screen for one\n // animation cycle. `lastBodyRef` is refreshed after every render, so the\n // snapshot is the rail exactly as it looked before the swap (correct active\n // item included) rather than a stale one.\n const [outgoing, setOutgoing] = React.useState<{ body: React.ReactNode; direction: 'forward' | 'back' } | null>(null)\n const lastBodyRef = React.useRef<React.ReactNode>(null)\n const lastKeyRef = React.useRef(navKey)\n const timerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null)\n\n useIsomorphicLayoutEffect(() => {\n if (lastKeyRef.current !== navKey) {\n const previousBody = lastBodyRef.current\n lastKeyRef.current = navKey\n if (previousBody) {\n setOutgoing({ body: previousBody, direction: navDirection })\n if (timerRef.current) clearTimeout(timerRef.current)\n timerRef.current = setTimeout(() => setOutgoing(null), RAIL_PUSH_MS)\n }\n }\n lastBodyRef.current = navBody\n })\n\n React.useEffect(() => () => { if (timerRef.current) clearTimeout(timerRef.current) }, [])\n\n return (\n <aside\n ref={railRef}\n data-print=\"hide\"\n onBlur={(event) => {\n // Focus left the rail entirely (tabbing past it) — the panel goes with\n // it. Moving between rows / into the panel stays inside.\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) flyout.dismiss()\n }}\n className={cn(\n // `relative` anchors the flyout, which hangs off the rail's right edge\n // and has to escape the nav's own scroll box to do it.\n 'relative flex h-full flex-col bg-sidebar text-sidebar-foreground transition-all duration-200',\n !borderless && 'border-r border-sidebar-border',\n collapsed ? 'w-16' : 'w-64'\n )}\n >\n {/* Logo + Collapse Toggle */}\n <div\n className={cn(\n 'flex h-14 items-center justify-between px-4',\n !borderless && 'border-b border-sidebar-border',\n collapsed && 'justify-center px-2'\n )}\n >\n {!collapsed && (\n <>\n {logo ?? <span className=\"text-lg font-bold\">App</span>}\n <button\n onClick={onToggle}\n className=\"ml-auto rounded-button p-1.5 text-sidebar-muted transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground\"\n aria-label=\"Collapse sidebar\"\n >\n <PanelLeftClose className=\"h-4 w-4\" />\n </button>\n </>\n )}\n {collapsed && (\n <button\n onClick={onToggle}\n className=\"rounded-button p-1.5 text-sidebar-muted transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground\"\n aria-label=\"Expand sidebar\"\n >\n <PanelLeft className=\"h-4 w-4\" />\n </button>\n )}\n </div>\n\n {/* Which workspace you are in comes FIRST — everything under it, search\n included, is scoped to this one. It used to live inside the swapping\n nav body (so it slid with a rail change); reading order won over that\n animation, and the contextual \"← back\" that shares this slot now\n simply swaps in place. */}\n {topContent && (\n <div className=\"px-2 pt-2\">{withCollapsed(topContent, collapsed)}</div>\n )}\n\n {/* Search — above the first destination. It used to be a 16px magnifier\n tucked beside the avatar at the very bottom, which is where you put\n something nobody is meant to find: the fastest way through an admin\n with thirty screens was the one control shaped like an afterthought.\n Here it reads as what it is — a field — and says which key opens it.\n Clicking it opens the same palette ⌘K does; it is a button, not an\n input, because typing happens there. */}\n <div className=\"px-2 pb-2 pt-2\">\n <button\n onClick={() => setCommandPaletteOpen(true)}\n aria-keyshortcuts=\"Meta+K Control+K\"\n className={cn(\n // Tonal surface, no outline. On a dark rail a 1px border is a hard\n // edge competing with every other hard edge; a lighter fill of the\n // same hue reads as \"a field\" without drawing a box around it — and\n // leaves the outline treatment free to mean focus, which it must.\n 'fz-tap group flex items-center rounded-lg bg-sidebar-accent/40 text-sidebar-muted transition-colors',\n 'hover:bg-sidebar-accent/70 hover:text-sidebar-foreground',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sidebar-accent-foreground/50',\n collapsed ? 'h-9 w-9 justify-center' : 'h-9 w-full gap-2.5 px-2.5',\n )}\n aria-label={searchLabel}\n title={collapsed ? searchLabel : undefined}\n >\n <Search className=\"h-4 w-4 shrink-0\" />\n {!collapsed && (\n <>\n <span className=\"flex-1 truncate text-left text-[13px]\">{searchLabel}</span>\n {/* The shortcut is a hint, not a control: no chip, no border, and\n it steps aside on hover rather than sitting there as chrome. */}\n <span className=\"shrink-0 text-[11px] font-medium tabular-nums text-sidebar-muted/60 transition-opacity group-hover:opacity-100 md:opacity-70\">\n {shortcutKey()}K\n </span>\n </>\n )}\n </button>\n </div>\n\n {/* Main Navigation. During a rail swap the outgoing nav is pinned on\n top of the incoming one so the two cross-slide; overflow is clipped\n for the duration so neither pane can scroll the rail sideways. */}\n <nav\n className={cn(\n 'relative flex-1 p-2',\n // scrollbar-none: the rail still scrolls, but without the native\n // scrollbar gutter eating into the nav items.\n outgoing ? 'overflow-hidden' : 'overflow-y-auto scrollbar-none',\n )}\n >\n {outgoing && (\n <div\n aria-hidden\n className={cn(\n 'pointer-events-none absolute inset-x-2 top-2 space-y-1',\n outgoing.direction === 'back' ? 'saas-rail-out-back' : 'saas-rail-out-forward',\n )}\n >\n {outgoing.body}\n </div>\n )}\n <div\n key={navKey}\n className={cn(\n 'space-y-1',\n outgoing && (outgoing.direction === 'back' ? 'saas-rail-in-back' : 'saas-rail-in-forward'),\n )}\n >\n {navBody}\n </div>\n </nav>\n\n {/* Settings nav items */}\n {settingsItems.length > 0 && (\n <div className={cn('p-2 space-y-1', !borderless && 'border-t border-sidebar-border')}>\n {settingsItems.map((item) => (\n <NavItem\n key={item.id}\n item={item}\n collapsed={collapsed}\n isActive={item.route === activeRoute}\n onNavigate={handleNavigate}\n flyout={flyout}\n />\n ))}\n </div>\n )}\n\n {footerContent && (\n // `empty:hidden` — slot children may all render null (e.g. the\n // SeuSiteWidget self-hides when the tenant has no project); without\n // it the padded/bordered wrapper shows as a blank block.\n <div className={cn('space-y-2 p-2 empty:hidden', !borderless && 'border-t border-sidebar-border')}>\n {footerContent}\n </div>\n )}\n\n {/* Org Switcher — above user row */}\n {withCollapsed(orgSwitcher, collapsed)}\n\n {/* Bottom: User row with inline action icons */}\n <div className={cn('p-2', !borderless && 'border-t border-sidebar-border')}>\n <div className={cn(\n 'flex items-center rounded-button',\n collapsed ? 'flex-col gap-1' : 'gap-1 px-1'\n )}>\n {/* User Menu slot */}\n {userMenuSlot}\n\n {/* Spacer pushes icons to right when expanded */}\n {!collapsed && <div className=\"flex-1\" />}\n\n {/* Notification slot or default bell */}\n {notificationSlot ?? (\n <button\n className=\"fz-tap relative inline-flex shrink-0 items-center justify-center rounded-button p-2 text-sidebar-muted transition-colors hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground\"\n aria-label={unreadCount > 0 ? `${unreadCount} unread notifications` : 'Notifications'}\n >\n <Bell className=\"h-4 w-4\" />\n {unreadCount > 0 && (\n <span className=\"absolute right-1 top-1 h-2 w-2 rounded-full bg-destructive\" />\n )}\n </button>\n )}\n </div>\n </div>\n\n {/* The rail's one flyout — anchored to whichever row is being pointed\n at, so it slides between them instead of blinking per row. */}\n {flyout.panel}\n </aside>\n )\n}\n","import * as React from 'react'\nimport * as Popover from '@radix-ui/react-popover'\nimport {\n Menu,\n Search,\n ChevronDown,\n Filter,\n Home,\n Users,\n Settings,\n CreditCard,\n Bell,\n Calendar,\n CalendarClock,\n Package,\n Activity,\n BarChart3,\n Clapperboard,\n Newspaper,\n FileText,\n Mail,\n DollarSign,\n Megaphone,\n ShoppingCart,\n ShoppingBag,\n Target,\n Wrench,\n ClipboardList,\n ClipboardCheck,\n Briefcase,\n UserCog,\n BookOpen,\n BookOpenCheck,\n GraduationCap,\n Repeat,\n MessageCircle,\n Globe,\n Percent,\n Tag,\n Tags,\n Camera,\n UtensilsCrossed,\n MapPin,\n Handshake,\n Contact,\n Building2,\n Plus,\n Shield,\n List,\n ListChecks,\n FileCheck2,\n FolderOpen,\n Dog,\n Cat,\n PawPrint,\n Heart,\n LayoutTemplate,\n LeafyGreen,\n Apple,\n Egg,\n Wheat,\n ArrowDownCircle,\n ArrowUpCircle,\n Landmark,\n Receipt,\n TrendingUp,\n CircleDollarSign,\n Wallet,\n Clock,\n AlertTriangle,\n Sparkles,\n Warehouse,\n Ruler,\n ArrowUpRight,\n ArrowDownRight,\n ArrowLeftRight,\n Plug,\n SlidersHorizontal,\n TableProperties,\n UserPlus,\n UserCheck,\n UserX,\n TreePalm,\n Boxes,\n Box,\n PartyPopper,\n Radio,\n CalendarDays,\n CalendarCheck2,\n CalendarX,\n BadgeDollarSign,\n Banknote,\n Layers,\n Music,\n Eye,\n ListMusic,\n ListPlus,\n Map,\n Ban,\n Clock3,\n Disc3,\n UsersRound,\n Mic,\n Inbox,\n Star,\n Zap,\n Crown,\n LogOut,\n type LucideIcon,\n} from 'lucide-react'\nimport { cn } from '../lib/cn'\nimport { useLayoutStore } from '../stores/layout.store'\n\nexport interface NavigationItem {\n id: string\n label: string\n icon: string\n route: string\n section: 'main' | 'secondary' | 'settings'\n /** Heading this item sits under within its section. Honoured by the sidebar\n * rail; the topbar has no headings and ignores it. */\n group?: string\n badge?: string | number\n children?: NavigationItem[]\n permission?: { feature: string; action: 'read' | 'create' | 'edit' | 'delete' }\n /** Freemium discovery: role-allowed but not entitled by the current plan.\n * Renders a small Crown badge; clicking leads to the plan's UpgradePrompt. */\n premium?: boolean\n}\n\nexport interface TopbarProps {\n navigation: NavigationItem[]\n logo?: React.ReactNode\n user?: { fullName: string; avatarUrl?: string; email: string }\n onMenuClick?: () => void\n /** Workspace/org switcher rendered with the right-side actions (desktop). */\n orgSwitcher?: React.ReactNode\n leftContent?: React.ReactNode\n rightContent?: React.ReactNode\n currentPath?: string\n onNavigate?: (route: string) => void\n searchPlaceholder?: string\n onSignOut?: () => void\n onProfile?: () => void\n onSettings?: () => void\n onBilling?: () => void\n /** Current-plan pill shown next to the user in the dropdown header. */\n userPlan?: { label: string; paid: boolean }\n /** i18n label for the billing/subscription menu item (host owns translation). */\n billingLabel?: string\n userMenuExtras?: { label: string; icon?: React.ReactNode; onClick: () => void }[]\n}\n\nfunction TopbarUserMenu({\n user,\n userPlan,\n billingLabel = 'Subscription',\n onSignOut,\n onProfile,\n onSettings,\n onBilling,\n userMenuExtras,\n}: Pick<TopbarProps, 'user' | 'userPlan' | 'billingLabel' | 'onSignOut' | 'onProfile' | 'onSettings' | 'onBilling' | 'userMenuExtras'>) {\n const [open, setOpen] = React.useState(false)\n if (!user) return null\n const initial = (user.fullName?.trim()?.[0] ?? user.email?.[0] ?? '?').toUpperCase()\n const item = (label: string, onClick?: () => void, Icon?: LucideIcon) =>\n onClick ? (\n <button\n key={label}\n onClick={() => { setOpen(false); onClick() }}\n className=\"flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-sm text-popover-foreground transition-colors hover:bg-muted/70\"\n >\n {Icon && <Icon className=\"h-4 w-4 text-muted-foreground\" />}\n <span>{label}</span>\n </button>\n ) : null\n return (\n <Popover.Root open={open} onOpenChange={setOpen}>\n <Popover.Trigger asChild>\n <button\n aria-label=\"User menu\"\n className=\"ml-1 flex h-9 w-9 items-center justify-center overflow-hidden rounded-full bg-primary text-xs font-semibold text-primary-foreground ring-2 ring-transparent transition hover:ring-sidebar-border\"\n >\n {user.avatarUrl ? (\n // eslint-disable-next-line @next/next/no-img-element\n <img src={user.avatarUrl} alt=\"\" className=\"h-full w-full object-cover\" />\n ) : (\n initial\n )}\n </button>\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Content\n align=\"end\"\n sideOffset={8}\n className=\"fayz-glass-surface z-50 min-w-[220px] rounded-xl border border-border bg-popover p-1.5 shadow-lg animate-in fade-in-0 zoom-in-95\"\n >\n <div className=\"border-b border-border px-3 py-2\">\n <p className=\"truncate text-sm font-medium text-foreground\">{user.fullName || user.email}</p>\n <p className=\"truncate text-xs text-muted-foreground\">{user.email}</p>\n </div>\n <div className=\"mt-1 space-y-0.5\">\n {item('Perfil', onProfile, UserCog)}\n {item('Configurações', onSettings, Settings)}\n {onBilling && (\n <button\n key=\"billing\"\n onClick={() => { setOpen(false); onBilling() }}\n className=\"flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-sm text-popover-foreground transition-colors hover:bg-muted/70\"\n >\n <CreditCard className=\"h-4 w-4 text-muted-foreground\" />\n <span className=\"flex-1 text-left\">{billingLabel}</span>\n {userPlan && (\n <span\n className={\n userPlan.paid\n ? 'inline-flex items-center gap-1 rounded-full border border-amber-400/40 bg-amber-400/15 px-2 py-0.5 text-[10px] font-semibold text-amber-600 dark:text-amber-300'\n : 'inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground'\n }\n >\n {userPlan.paid ? <Crown className=\"h-3 w-3\" /> : <Sparkles className=\"h-3 w-3\" />}\n {userPlan.label}\n </span>\n )}\n </button>\n )}\n {userMenuExtras?.map((e) => item(e.label, e.onClick))}\n {onSignOut && (\n <>\n <div className=\"my-1 border-t border-border\" />\n {item('Sair', onSignOut, LogOut)}\n </>\n )}\n </div>\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n )\n}\n\nexport const ICON_MAP: Record<string, LucideIcon> = {\n Home, Users, Settings, CreditCard, Bell, Calendar, CalendarClock, Package, Activity, BarChart3,\n FileText, Mail, DollarSign, Megaphone, ShoppingCart, ShoppingBag, Target, Wrench,\n ClipboardList, ClipboardCheck, Briefcase, UserCog, BookOpen, MessageCircle, Globe,\n BookOpenCheck, Percent, Tag, Tags, Camera, UtensilsCrossed, Search, MapPin, Handshake,\n Contact, Building2, ChevronDown, Filter, Plus, Shield, List, ListChecks, FolderOpen, Dog, Cat, PawPrint, Heart, LayoutTemplate, LeafyGreen, Apple, Egg, Wheat,\n ArrowDownCircle, ArrowUpCircle, ArrowLeftRight, Plug, SlidersHorizontal, TableProperties, Landmark, Receipt, TrendingUp, CircleDollarSign, Clock, AlertTriangle, Sparkles, Wallet, Warehouse, Ruler, ArrowUpRight, ArrowDownRight, UserPlus, UserX, TreePalm,\n Boxes, Box, FileCheck2, PartyPopper, Radio, CalendarDays, BadgeDollarSign, Banknote, Layers, Music, Eye, ListMusic, Disc3, UsersRound, Mic,\n CalendarCheck2, CalendarX, ListPlus, Map, Ban, Clock3, Inbox, UserCheck, Star, Zap, Clapperboard, Newspaper, GraduationCap, Repeat,\n}\n\nfunction getIcon(name: string): LucideIcon {\n return ICON_MAP[name] ?? Home\n}\n\nfunction NavDropdown({ item, currentPath, onNavigate }: {\n item: NavigationItem\n currentPath: string\n onNavigate: (route: string) => void\n}) {\n const [open, setOpen] = React.useState(false)\n const Icon = getIcon(item.icon)\n const isChildActive = item.children?.some(\n (child) => currentPath === child.route || currentPath.startsWith(child.route + '/')\n )\n\n return (\n <Popover.Root open={open} onOpenChange={setOpen}>\n <Popover.Trigger asChild>\n <button\n data-nav-active={isChildActive || undefined}\n className={cn(\n 'flex items-center gap-1.5 whitespace-nowrap border-b-2 px-3 py-2 text-sm transition-colors',\n isChildActive\n ? 'border-sidebar-accent-foreground font-semibold text-sidebar-foreground'\n : 'border-transparent text-sidebar-muted hover:text-sidebar-foreground'\n )}\n >\n <Icon className=\"h-4 w-4\" />\n <span>{item.label}</span>\n <ChevronDown className={cn('h-3 w-3 transition-transform', open && 'rotate-180')} />\n </button>\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Content\n align=\"start\"\n sideOffset={4}\n className=\"fayz-glass-surface z-50 min-w-[200px] rounded-xl border border-border bg-popover p-1.5 shadow-lg animate-in fade-in-0 zoom-in-95\"\n >\n {item.children?.map((child) => {\n const ChildIcon = getIcon(child.icon)\n const isActive = currentPath === child.route || currentPath.startsWith(child.route + '/')\n return (\n <button\n key={child.id}\n onClick={() => {\n onNavigate(child.route)\n setOpen(false)\n }}\n className={cn(\n 'flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-sm transition-colors',\n isActive\n ? 'bg-muted font-medium text-foreground'\n : 'text-popover-foreground hover:bg-muted/70'\n )}\n >\n <ChildIcon className=\"h-4 w-4 text-muted-foreground\" />\n <span>{child.label}</span>\n </button>\n )\n })}\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n )\n}\n\nexport function Topbar({\n navigation,\n logo,\n user,\n onMenuClick,\n orgSwitcher,\n leftContent,\n rightContent,\n currentPath = '/',\n onNavigate,\n searchPlaceholder = 'Search...',\n onSignOut,\n onProfile,\n onSettings,\n onBilling,\n userPlan,\n billingLabel,\n userMenuExtras,\n}: TopbarProps) {\n const setCommandPaletteOpen = useLayoutStore((s) => s.setCommandPaletteOpen)\n\n const mainNav = navigation.filter((item) => item.section === 'main')\n const secondaryNav = navigation.filter((item) => item.section === 'secondary')\n const allNav = [...mainNav, ...secondaryNav]\n\n const handleNavigate = (route: string) => {\n onNavigate?.(route)\n }\n\n return (\n <header data-print=\"hide\" className=\"sticky top-0 z-50 w-full shrink-0\">\n {/* Row 1: Logo + Search + Actions */}\n <div className=\"border-b border-sidebar-border bg-sidebar text-sidebar-foreground\">\n <div className=\"flex h-14 w-full items-center justify-between px-4 md:px-6\">\n {/* Left: Mobile menu + Logo — the hamburger is only rendered when an\n onMenuClick handler is supplied. Mobile-first apps with a bottom\n nav omit it so the bottom bar is the primary navigation. */}\n <div className=\"flex items-center gap-3\">\n {onMenuClick && (\n <button\n onClick={onMenuClick}\n className=\"inline-flex items-center justify-center rounded-md p-2 text-sidebar-foreground/70 hover:bg-sidebar/30 hover:text-sidebar-foreground md:hidden\"\n aria-label=\"Open menu\"\n >\n <Menu className=\"h-5 w-5\" />\n </button>\n )}\n <div className=\"hidden shrink-0 items-center md:flex\">\n {logo ?? <span className=\"text-lg font-bold\">App</span>}\n </div>\n </div>\n\n {/* Center: Search (desktop only) */}\n <div className=\"mx-8 hidden max-w-sm flex-1 md:flex\">\n <button\n onClick={() => setCommandPaletteOpen(true)}\n className=\"relative flex h-8 w-full items-center rounded-md border border-sidebar-border bg-sidebar-accent px-3 pl-8 text-sm text-sidebar-muted shadow-sm transition-colors hover:border-sidebar-foreground/25 hover:bg-sidebar-foreground/10 hover:text-sidebar-foreground\"\n >\n <Search className=\"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-sidebar-muted\" />\n <span className=\"text-xs\">{searchPlaceholder}</span>\n <kbd className=\"ml-auto hidden rounded border border-sidebar-border bg-sidebar-accent px-1.5 py-0.5 text-[10px] font-medium text-sidebar-muted sm:inline-block\">\n ⌘K\n </kbd>\n </button>\n </div>\n\n {/* Right: Actions — o seletor de workspace abre o grupo. Ao lado do\n logo ele lia como parte da marca (\"GlowStudio Clínica Sol\"); aqui\n ele fica entre as coisas que MUDAM a sessão (tarefas, avisos,\n conta), que é o que ele é. */}\n <div className=\"flex min-w-0 items-center gap-1\">\n {orgSwitcher && (\n <div className=\"hidden min-w-0 items-center md:flex\">{orgSwitcher}</div>\n )}\n {leftContent}\n {rightContent}\n <TopbarUserMenu\n user={user}\n userPlan={userPlan}\n billingLabel={billingLabel}\n onSignOut={onSignOut}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n userMenuExtras={userMenuExtras}\n />\n </div>\n </div>\n </div>\n\n {/* Row 2: Navigation — desktop only */}\n <div className=\"hidden md:block bg-sidebar\">\n <div className=\"flex h-11 w-full items-center px-4 md:px-6\">\n <nav ref={(el) => {\n if (!el) return\n const active = el.querySelector('[data-nav-active=\"true\"]') as HTMLElement\n if (active) {\n const left = active.offsetLeft - el.offsetWidth / 2 + active.offsetWidth / 2\n el.scrollTo({ left: Math.max(0, left), behavior: 'smooth' })\n }\n }} className=\"flex items-center gap-0.5 overflow-x-auto scrollbar-none\">\n {allNav.map((item) => {\n if (item.children && item.children.length > 0) {\n return (\n <NavDropdown\n key={item.id}\n item={item}\n currentPath={currentPath}\n onNavigate={handleNavigate}\n />\n )\n }\n\n const Icon = getIcon(item.icon)\n const isActive =\n item.route === '/'\n ? currentPath === '/'\n : currentPath === item.route || currentPath.startsWith(item.route + '/')\n\n return (\n <button\n key={item.id}\n data-nav-active={isActive || undefined}\n onClick={() => handleNavigate(item.route)}\n className={cn(\n 'flex items-center gap-1.5 whitespace-nowrap border-b-2 px-3 py-2 text-sm transition-colors',\n isActive\n ? 'border-primary font-semibold text-sidebar-foreground'\n : 'border-transparent text-sidebar-muted hover:text-sidebar-foreground'\n )}\n >\n <Icon className=\"h-4 w-4\" />\n <span>{item.label}</span>\n {item.premium && (\n <Crown className=\"h-3 w-3 text-amber-500\" aria-hidden />\n )}\n {item.badge !== undefined && (\n <span className=\"rounded-full bg-primary px-1.5 py-0.5 text-[10px] font-semibold text-primary-foreground\">\n {item.badge}\n </span>\n )}\n </button>\n )\n })}\n </nav>\n </div>\n </div>\n </header>\n )\n}\n","import * as React from 'react'\nimport {\n Menu,\n Home,\n Receipt,\n ArrowLeftRight,\n Calendar,\n CreditCard,\n Settings,\n MessageCircle,\n Wallet,\n PiggyBank,\n Plus,\n ArrowLeft,\n type LucideIcon,\n} from 'lucide-react'\nimport { Sidebar, type NavigationItem, type SidebarUser, type SidebarProps } from './Sidebar'\nimport { Topbar } from './Topbar'\nimport { SaveBar, SaveBarProvider } from './SaveBar'\nimport { useLayoutStore } from '../stores/layout.store'\nimport { usePageHeaderSlot, usePageHeaderHost, useHasPageHeaderOutlet } from '../stores/page-header.store'\nimport { PageHeaderCrumb } from '../primitives/page-header'\nimport { cn } from '../lib/cn'\n\n// ---------------------------------------------------------------------------\n// Module header slot — the page top-bar exposes a DOM node that module pages\n// (ModulePage 'tabs' variant) portal their title + sub-nav into, so the module\n// header lives in the shell's top-of-page container (GoHighLevel style).\n// ---------------------------------------------------------------------------\n\nconst ModuleHeaderSlotContext = React.createContext<HTMLElement | null>(null)\n\nexport function useModuleHeaderSlot(): HTMLElement | null {\n return React.useContext(ModuleHeaderSlotContext)\n}\n\n// Right-aligned slot for a page's primary action buttons (e.g. \"New campaign\").\nconst ModuleHeaderActionsSlotContext = React.createContext<HTMLElement | null>(null)\n\nexport function useModuleHeaderActionsSlot(): HTMLElement | null {\n return React.useContext(ModuleHeaderActionsSlotContext)\n}\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface AppShellUser {\n fullName: string\n avatarUrl?: string\n email: string\n}\n\n// ---------------------------------------------------------------------------\n// Bottom-nav item model\n//\n// Two kinds share the mobile tab bar:\n// - route (default): a normal tab that navigates to `route`.\n// - action: a NON-route item rendered as a raised, elevated circular center\n// button (Mobills style). It fires `onBottomNavAction(id)` instead of\n// navigating — e.g. a global quick-add \"+\".\n// ---------------------------------------------------------------------------\n\nexport interface BottomNavRouteItem {\n kind?: 'route'\n label: string\n icon: string\n route: string\n}\n\nexport interface BottomNavActionItem {\n kind: 'action'\n /** Identifier passed to onBottomNavAction. */\n id: string\n icon: string\n /** Optional accessible label. */\n label?: string\n}\n\nexport type BottomNavItem = BottomNavRouteItem | BottomNavActionItem\n\n/** Mobile header treatment (small screens, <md). Desktop is unaffected.\n * - 'minimal' : a small top header bar (the default / today's behavior).\n * - 'transparent' : NO header bar; content is edge-to-edge with a floating\n * profile avatar pinned top-right (calls onProfile).\n * - 'hidden' : no header bar and no floating avatar. */\nexport type MobileHeaderVariant = 'transparent' | 'minimal' | 'hidden'\n\nexport interface AppShellProps {\n /** Layout variant */\n variant: 'sidebar' | 'topbar' | 'minimal'\n /** Wrap the main content in an inset framed card. The sidebar is always\n * flush/full-height (GoHighLevel style). */\n contentFrame?: boolean\n navigation?: NavigationItem[]\n logo?: React.ReactNode\n user?: AppShellUser\n children?: React.ReactNode\n onNavigate?: (route: string) => void\n onSignOut?: () => void\n onProfile?: () => void\n onSettings?: () => void\n onBilling?: () => void\n /** Current-plan pill shown next to the user in the topbar menu. */\n userPlan?: { label: string; paid: boolean }\n /** i18n label for the billing/subscription user-menu item. */\n billingLabel?: string\n pageTitle?: string\n /**\n * Seta de voltar da barra, quando a ROTA declara um pai. É o caminho sem\n * código de página: `parentRoute` no manifesto e pronto. Uma página que\n * reivindica o slot (PageHeader) ganha desta — o cabeçalho dela sabe mais,\n * porque tem o dado carregado.\n */\n pageBack?: { onBack: () => void; label?: string }\n currentPath?: string\n userMenuExtras?: { label: string; icon?: React.ReactNode; onClick: () => void }[]\n orgSwitcher?: React.ReactNode\n topbarStart?: React.ReactNode\n topbarEnd?: React.ReactNode\n sidebarTopContent?: React.ReactNode\n sidebarNavTop?: React.ReactNode\n sidebarFooterContent?: React.ReactNode\n bottomNav?: BottomNavItem[]\n /** Fired when a bottom-nav `action` item (e.g. the center \"+\") is tapped. */\n onBottomNavAction?: (id: string) => void\n /** Mobile header treatment (<md). Default: 'minimal'. Desktop unaffected. */\n mobileHeader?: MobileHeaderVariant\n /** Rendered in sidebar bottom user slot */\n userMenuSlot?: React.ReactNode\n /** Rendered in sidebar bottom notification slot */\n notificationSlot?: React.ReactNode\n /** Unread notification count */\n unreadCount?: number\n /** Placeholder on the rail's search field. Translated by the shell. */\n searchLabel?: string\n /** Optional headings above the sidebar nav sections (contextual sidebars). */\n sidebarSectionLabels?: { main?: string; secondary?: string; settings?: string }\n /** Identity of the current sidebar context — changing it animates the rail\n * swap as a push (new nav in, previous nav out). */\n sidebarNavKey?: string\n /** Push direction for a `sidebarNavKey` change. Default 'forward'. */\n sidebarNavDirection?: 'forward' | 'back'\n /** Render nav-group children as bare labels with an elbow marking the active\n * one, instead of an icon each. See Sidebar's `navChildConnector`. */\n sidebarNavChildConnector?: boolean\n /**\n * Full-height column pinned to the right (the assistant dock, a tasks\n * panel). Rendered as a flex SIBLING of the layout, so the app narrows to\n * make room instead of being covered — the difference between a split view\n * and a modal that happens to be tall.\n *\n * Falsy renders nothing and costs nothing: no wrapper, no divider, the\n * layout element stands alone exactly as before.\n */\n rightRail?: React.ReactNode\n /** Whether the rail is showing. Separate from `rightRail` so the column can\n * animate its width instead of snapping when it closes. */\n rightRailOpen?: boolean\n /** Starting width in px. Ignored once the user drags. Default 380. */\n defaultRightRailWidth?: number\n /** Fired after every drag so the host can persist the preference. */\n onRightRailWidthChange?: (width: number) => void\n /** Drag bounds in px. Defaults 300 / 720. */\n rightRailMinWidth?: number\n rightRailMaxWidth?: number\n /** Accessible name for the drag handle. */\n rightRailResizeLabel?: string\n}\n\n// ---------------------------------------------------------------------------\n// ShellPageTitle — o que a barra mostra quando NENHUMA página reivindicou o\n// slot: o título da rota/menu e, se a rota declarou um pai, o caminho de volta.\n//\n// Reusa o traço de `PageHeaderCrumb`, o mesmo que o componente `PageHeader`\n// usa. A seta tem que ser a MESMA seta, venha ela do manifesto ou da própria\n// página — dois desenhos foi exatamente o que este trabalho veio desfazer.\n// ---------------------------------------------------------------------------\n\nfunction ShellPageTitle({\n title,\n back,\n}: {\n title?: string\n back?: AppShellProps['pageBack']\n}) {\n if (!title && !back) return null\n return <PageHeaderCrumb title={title} parentLabel={back?.label} onBack={back?.onBack} />\n}\n\n// ---------------------------------------------------------------------------\n// Sidebar layout\n// ---------------------------------------------------------------------------\n\nfunction SidebarLayout({\n navigation = [],\n logo,\n user,\n children,\n onNavigate,\n onSignOut,\n onProfile,\n onSettings,\n onBilling,\n userMenuExtras: _userMenuExtras,\n orgSwitcher,\n sidebarTopContent,\n sidebarNavTop,\n sidebarFooterContent,\n frame,\n currentPath,\n pageTitle,\n pageBack,\n topbarStart,\n topbarEnd,\n userMenuSlot,\n notificationSlot,\n unreadCount = 0,\n searchLabel,\n hasBottomNav = false,\n mobileHeader = 'minimal',\n sidebarSectionLabels,\n sidebarNavKey,\n sidebarNavDirection,\n sidebarNavChildConnector,\n}: {\n navigation?: NavigationItem[]\n logo?: React.ReactNode\n user?: AppShellUser\n children?: React.ReactNode\n onNavigate?: (route: string) => void\n onSignOut?: () => void\n onProfile?: () => void\n onSettings?: () => void\n onBilling?: () => void\n userMenuExtras?: AppShellProps['userMenuExtras']\n orgSwitcher?: React.ReactNode\n sidebarTopContent?: React.ReactNode\n sidebarNavTop?: React.ReactNode\n sidebarFooterContent?: React.ReactNode\n frame?: boolean\n currentPath?: string\n pageTitle?: string\n pageBack?: AppShellProps['pageBack']\n topbarStart?: React.ReactNode\n topbarEnd?: React.ReactNode\n userMenuSlot?: React.ReactNode\n notificationSlot?: React.ReactNode\n unreadCount?: number\n /** Placeholder on the rail's search field. Translated by the shell. */\n searchLabel?: string\n /** When a mobile bottom-nav bar is present, the mobile hamburger is\n * suppressed so the bottom nav is the primary mobile navigation. */\n hasBottomNav?: boolean\n /** Mobile header treatment (<md). Desktop keeps its top bar untouched. */\n mobileHeader?: MobileHeaderVariant\n sidebarSectionLabels?: AppShellProps['sidebarSectionLabels']\n sidebarNavKey?: string\n sidebarNavDirection?: 'forward' | 'back'\n sidebarNavChildConnector?: boolean\n}) {\n const sidebarCollapsed = useLayoutStore((s) => s.sidebarCollapsed)\n const pageHeaderSlot = usePageHeaderSlot()\n // Declara que ESTA shell mostra o slot — é o que deixa PageHeader saber que\n // pode entregar o cabeçalho para a barra em vez de desenhá-lo no corpo.\n usePageHeaderHost()\n const setSidebarCollapsed = useLayoutStore((s) => s.setSidebarCollapsed)\n const [mobileMenuOpen, setMobileMenuOpen] = React.useState(false)\n const [headerSlot, setHeaderSlot] = React.useState<HTMLElement | null>(null)\n const [actionsSlot, setActionsSlot] = React.useState<HTMLElement | null>(null)\n\n return (\n <SaveBarProvider>\n <ModuleHeaderSlotContext.Provider value={headerSlot}>\n <ModuleHeaderActionsSlotContext.Provider value={actionsSlot}>\n <div className={cn(\n 'flex h-screen overflow-hidden bg-background',\n // Frame mode: the inset gap around the framed card takes the sidebar (menu)\n // color, so the white card reads as a panel floating on the same tone as the\n // left menu. The card's own md:m-2 margin reveals this behind it.\n frame && 'md:bg-sidebar',\n )}>\n {/* Desktop Sidebar — always flush / full-height (GoHighLevel style) */}\n <div className=\"hidden md:flex\">\n <Sidebar\n navigation={navigation}\n logo={logo}\n collapsed={sidebarCollapsed}\n onToggle={() => setSidebarCollapsed(!sidebarCollapsed)}\n onNavigate={onNavigate}\n currentPath={currentPath}\n user={user}\n onSignOut={onSignOut}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n orgSwitcher={orgSwitcher}\n topContent={sidebarTopContent}\n navTop={sidebarNavTop}\n footerContent={sidebarFooterContent}\n borderless={false}\n userMenuSlot={userMenuSlot}\n notificationSlot={notificationSlot}\n unreadCount={unreadCount}\n searchLabel={searchLabel}\n sectionLabels={sidebarSectionLabels}\n navKey={sidebarNavKey}\n navDirection={sidebarNavDirection}\n navChildConnector={sidebarNavChildConnector}\n />\n </div>\n\n {/* Main content — optionally wrapped in an inset framed card.\n The inset/rounding is suppressed on mobile so the content stays\n edge-to-edge (the framed card only reads well on larger screens). */}\n <div className={cn(\n 'relative flex flex-1 flex-col overflow-hidden',\n frame && 'md:m-2 md:rounded-xl md:border md:border-border md:bg-card'\n )}>\n {/* Top bar — mobile hamburger + module header slot (title + sub-nav) + actions.\n On mobile the bar is suppressed for the 'transparent' / 'hidden' header\n treatments (content goes edge-to-edge); desktop keeps it always. The\n portal targets below stay mounted (display:none on mobile) so module\n pages can still portal their sub-nav on desktop without crashing. */}\n <div className={cn(\n 'flex min-h-14 shrink-0 items-center justify-between gap-3 border-b border-border bg-card px-4 py-2',\n mobileHeader !== 'minimal' && 'hidden md:flex',\n )}>\n <div className=\"flex min-w-0 flex-1 items-center gap-3\">\n {/* Mobile hamburger — suppressed when a bottom-nav bar owns mobile\n navigation (mobile-first apps). Desktop sidebar is untouched. */}\n {!hasBottomNav && (\n <button\n onClick={() => setMobileMenuOpen(true)}\n className=\"inline-flex items-center justify-center rounded-md p-2 text-muted-foreground hover:bg-accent md:hidden\"\n aria-label=\"Open menu\"\n >\n <Menu className=\"h-5 w-5\" />\n </button>\n )}\n {/* A sub-page (form, detail) claims this slot with its own back\n link / breadcrumb — it already says where you are, and printing\n the section title above it spent a whole row repeating a word. */}\n {pageHeaderSlot ?? <ShellPageTitle title={pageTitle} back={pageBack} />}\n {topbarStart}\n {/* Module pages (tabs variant) portal their sub-nav here */}\n <div ref={setHeaderSlot} className=\"flex min-w-0 flex-1 items-center\" />\n </div>\n <div className=\"flex shrink-0 items-center gap-2\">\n {/* Pages portal their primary action buttons here */}\n <div ref={setActionsSlot} className=\"flex items-center gap-2\" />\n {topbarEnd}\n </div>\n </div>\n\n {/* Page content */}\n <main className=\"min-w-0 flex-1 overflow-y-auto pb-16 md:pb-0\">\n {children}\n </main>\n\n {/* App-wide floating SaveBar (spans the content column, not the sidebar) */}\n <SaveBar />\n </div>\n\n {/* Mobile drawer — animated, owns its own close transition. */}\n {mobileMenuOpen && (\n <MobileOverlay\n navigation={navigation}\n logo={logo}\n user={user}\n currentPath={currentPath}\n onNavigate={onNavigate}\n onSignOut={onSignOut}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n orgSwitcher={orgSwitcher}\n topContent={sidebarTopContent}\n navTop={sidebarNavTop}\n footerContent={sidebarFooterContent}\n userMenuSlot={userMenuSlot}\n notificationSlot={notificationSlot}\n unreadCount={unreadCount}\n searchLabel={searchLabel}\n onClose={() => setMobileMenuOpen(false)}\n />\n )}\n </div>\n </ModuleHeaderActionsSlotContext.Provider>\n </ModuleHeaderSlotContext.Provider>\n </SaveBarProvider>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Topbar layout\n// ---------------------------------------------------------------------------\n\nfunction TopbarLayout({\n navigation = [],\n logo,\n user,\n children,\n onNavigate,\n onSignOut,\n onProfile,\n onSettings,\n onBilling,\n userPlan,\n billingLabel,\n userMenuExtras,\n orgSwitcher,\n frame,\n currentPath,\n topbarStart,\n topbarEnd,\n pageTitle,\n pageBack,\n notificationSlot,\n hasBottomNav = false,\n}: {\n navigation?: NavigationItem[]\n logo?: React.ReactNode\n user?: AppShellUser\n children?: React.ReactNode\n onNavigate?: (route: string) => void\n onSignOut?: () => void\n onProfile?: () => void\n onSettings?: () => void\n onBilling?: () => void\n userPlan?: AppShellProps['userPlan']\n billingLabel?: AppShellProps['billingLabel']\n userMenuExtras?: AppShellProps['userMenuExtras']\n /** Workspace switcher — rendered with the right-side actions (desktop) and in the mobile drawer. */\n orgSwitcher?: React.ReactNode\n frame?: boolean\n currentPath?: string\n topbarStart?: React.ReactNode\n topbarEnd?: React.ReactNode\n pageTitle?: string\n pageBack?: AppShellProps['pageBack']\n /** Bell/inbox slot — in the topbar layout it renders with the right-side actions. */\n notificationSlot?: React.ReactNode\n /** When a mobile bottom-nav bar is present, the mobile hamburger is\n * suppressed so the bottom nav is the primary mobile navigation. */\n hasBottomNav?: boolean\n}) {\n const [mobileMenuOpen, setMobileMenuOpen] = React.useState(false)\n const rawSlot = usePageHeaderSlot()\n const hasOutlet = useHasPageHeaderOutlet()\n usePageHeaderHost()\n // Um outlet mais fundo (a coluna de conteúdo de um módulo com trilha) já\n // desenha o cabeçalho no lugar certo — a barra larga aqui seria a segunda.\n const pageHeaderSlot = hasOutlet ? null : rawSlot\n\n // Same page title the sidebar layout draws. The horizontal nav marks the\n // GROUP (\"Registry\"), not the screen (\"Categories\").\n const showTitle = !hasOutlet && !!pageTitle\n\n // Topbar is full-bleed (edge to edge); only the content area gets the frame.\n return (\n <SaveBarProvider>\n <div className=\"relative flex h-screen flex-col overflow-hidden bg-background\">\n <Topbar\n navigation={navigation}\n logo={logo}\n user={user}\n currentPath={currentPath}\n onNavigate={onNavigate}\n onSignOut={onSignOut}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n userPlan={userPlan}\n billingLabel={billingLabel}\n userMenuExtras={userMenuExtras}\n orgSwitcher={orgSwitcher}\n leftContent={topbarStart}\n rightContent={(topbarEnd || notificationSlot) ? <>{topbarEnd}{notificationSlot}</> : undefined}\n onMenuClick={hasBottomNav ? undefined : () => setMobileMenuOpen(true)}\n />\n {/* Frame inset/border only from md up, so mobile stays edge-to-edge. The\n inset gap behind the framed card is the header color (bg-sidebar), so the\n white card reads as a panel floating on the same navy as the topbar. */}\n {/* The frame is fixed to the viewport and the content scrolls INSIDE it,\n mirroring SidebarLayout. With `main` as the scroller the card grew with\n the page and its bottom edge rode off-screen. */}\n <main className={cn('flex min-w-0 min-h-0 flex-1 flex-col overflow-hidden', frame && 'md:bg-sidebar md:p-2')}>\n <div className={cn('flex min-w-0 min-h-0 flex-1 flex-col overflow-hidden', frame && 'md:rounded-xl md:border md:border-border md:bg-card')}>\n {/* Page header — the same band the sidebar layout has. Without it a\n page that claimed the slot had its \"← back\" drawn by nobody. */}\n {(pageHeaderSlot || pageBack || showTitle) && (\n <div className=\"flex min-h-12 shrink-0 items-center gap-3 border-b border-border px-4 py-2\">\n {pageHeaderSlot ?? <ShellPageTitle title={showTitle ? pageTitle : undefined} back={pageBack} />}\n </div>\n )}\n <div className=\"min-h-0 flex-1 overflow-y-auto pb-16 md:pb-0\">\n {children}\n </div>\n </div>\n </main>\n\n {/* App-wide floating SaveBar */}\n <SaveBar />\n\n {/* Mobile drawer — topbar has no persistent sidebar, so the burger opens\n the same animated nav drawer used by the sidebar layout. */}\n {mobileMenuOpen && (\n <MobileOverlay\n navigation={navigation}\n logo={logo}\n user={user}\n currentPath={currentPath}\n onNavigate={onNavigate}\n onSignOut={onSignOut}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n orgSwitcher={orgSwitcher}\n userMenuSlot={user ? <DrawerUserRow user={user} /> : undefined}\n onClose={() => setMobileMenuOpen(false)}\n />\n )}\n </div>\n </SaveBarProvider>\n )\n}\n\n// Compact user identity for the mobile drawer's bottom row.\nfunction DrawerUserRow({ user }: { user: AppShellUser }) {\n const label = user.fullName || user.email\n return (\n <div className=\"flex min-w-0 items-center gap-2 px-1\">\n {user.avatarUrl ? (\n <img src={user.avatarUrl} alt=\"\" className=\"h-7 w-7 shrink-0 rounded-full object-cover\" />\n ) : (\n <span className=\"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary text-xs font-semibold text-primary-foreground\">\n {(label || '?').charAt(0).toUpperCase()}\n </span>\n )}\n <span className=\"truncate text-sm font-medium text-sidebar-foreground\">{label}</span>\n </div>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Minimal layout\n// ---------------------------------------------------------------------------\n\nfunction MinimalLayout({\n logo,\n user: _user,\n children,\n headerEnd,\n}: {\n logo?: React.ReactNode\n user?: AppShellUser\n children?: React.ReactNode\n headerEnd?: React.ReactNode\n}) {\n return (\n <div className=\"flex h-screen flex-col\">\n <header className=\"flex h-14 shrink-0 items-center justify-between border-b border-border bg-card px-4 md:px-6\">\n <div className=\"flex items-center gap-3\">\n {logo ?? <span className=\"text-lg font-bold\">App</span>}\n </div>\n {headerEnd && <div className=\"flex items-center gap-2\">{headerEnd}</div>}\n </header>\n <main className=\"min-w-0 flex-1 overflow-y-auto pb-16 md:pb-0\">\n {children}\n </main>\n </div>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Mobile overlay drawer\n// ---------------------------------------------------------------------------\n\ntype MobileOverlayProps = Omit<SidebarProps, 'collapsed' | 'onToggle'> & {\n onClose: () => void\n}\n\nfunction MobileOverlay({ onClose, onNavigate, ...sidebarProps }: MobileOverlayProps) {\n // Mount hidden, then flip to visible on the next frame so the CSS transition\n // plays on open. On dismiss we play the exit transition first, then unmount.\n const [visible, setVisible] = React.useState(false)\n\n React.useEffect(() => {\n const id = requestAnimationFrame(() => setVisible(true))\n return () => cancelAnimationFrame(id)\n }, [])\n\n const close = React.useCallback(() => {\n setVisible(false)\n window.setTimeout(onClose, 250)\n }, [onClose])\n\n // Lock body scroll while the drawer is open.\n React.useEffect(() => {\n const previous = document.body.style.overflow\n document.body.style.overflow = 'hidden'\n return () => {\n document.body.style.overflow = previous\n }\n }, [])\n\n // Dismiss on Escape.\n React.useEffect(() => {\n const onKey = (e: KeyboardEvent) => {\n if (e.key === 'Escape') close()\n }\n window.addEventListener('keydown', onKey)\n return () => window.removeEventListener('keydown', onKey)\n }, [close])\n\n return (\n <div className=\"fixed inset-0 z-[60] md:hidden\">\n {/* Backdrop — fades in/out */}\n <div\n className={cn(\n 'absolute inset-0 bg-black/50 transition-opacity duration-300 ease-out',\n visible ? 'opacity-100' : 'opacity-0',\n )}\n onClick={close}\n />\n {/* Drawer — slides in from the left, reusing the real Sidebar for full\n design parity (icons, active state, org switcher, bottom user row). */}\n <div\n className={cn(\n 'absolute inset-y-0 left-0 shadow-2xl transition-transform duration-300 ease-out will-change-transform',\n visible ? 'translate-x-0' : '-translate-x-full',\n )}\n >\n <Sidebar\n {...sidebarProps}\n collapsed={false}\n onToggle={close}\n borderless\n onNavigate={(route) => {\n onNavigate?.(route)\n close()\n }}\n />\n </div>\n </div>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Mobile bottom tab bar — rendered for every variant on small screens.\n// ui must NOT import from saas, so the icon lookup is a small local map (a\n// mirror of the saas icon convention). Unknown icon names fall back to Home.\n// ---------------------------------------------------------------------------\n\nconst BOTTOM_NAV_ICONS: Record<string, LucideIcon> = {\n Home,\n Receipt,\n ArrowLeftRight,\n Calendar,\n CreditCard,\n Settings,\n Menu,\n MessageCircle,\n Wallet,\n PiggyBank,\n Plus,\n}\n\n// Floating profile avatar — mobile-only (md:hidden), pinned top-right over the\n// content. Used with the 'transparent' mobile header treatment so there is no\n// header bar but the user still has a one-tap route into their profile.\nfunction FloatingProfileAvatar({ user, onClick }: { user?: AppShellUser; onClick?: () => void }) {\n if (!user) return null\n const label = user.fullName || user.email\n return (\n <button\n type=\"button\"\n onClick={onClick}\n aria-label=\"Profile\"\n className=\"fixed right-3 top-3 z-40 md:hidden\"\n >\n {user.avatarUrl ? (\n <img\n src={user.avatarUrl}\n alt=\"\"\n className=\"h-9 w-9 rounded-full object-cover shadow-md ring-2 ring-background\"\n />\n ) : (\n <span className=\"flex h-9 w-9 items-center justify-center rounded-full bg-primary text-sm font-semibold text-primary-foreground shadow-md ring-2 ring-background\">\n {(label || '?').charAt(0).toUpperCase()}\n </span>\n )}\n </button>\n )\n}\n\nfunction MobileBottomNav({\n items,\n currentPath,\n onNavigate,\n onAction,\n}: {\n items: NonNullable<AppShellProps['bottomNav']>\n currentPath?: string\n onNavigate?: (route: string) => void\n onAction?: (id: string) => void\n}) {\n const path = currentPath ?? ''\n return (\n <nav className=\"fixed inset-x-0 bottom-0 z-50 flex h-16 items-center justify-around border-t border-border bg-background md:hidden\">\n {items.map((item) => {\n // Elevated center ACTION button (Mobills style) — raised above the bar,\n // circular, primary-filled; fires onBottomNavAction instead of routing.\n if (item.kind === 'action') {\n const ActionIcon = BOTTOM_NAV_ICONS[item.icon] ?? Plus\n return (\n <div key={item.id} className=\"flex flex-1 items-start justify-center\">\n <button\n type=\"button\"\n onClick={() => onAction?.(item.id)}\n aria-label={item.label ?? 'Add'}\n className=\"-mt-6 flex h-14 w-14 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-lg shadow-primary/30 ring-4 ring-background transition-transform active:scale-95\"\n >\n <ActionIcon className=\"h-6 w-6\" />\n </button>\n </div>\n )\n }\n const isActive =\n item.route === '/'\n ? path === '/' || path === ''\n : path === item.route || path.startsWith(item.route + '/')\n const Icon = BOTTOM_NAV_ICONS[item.icon] ?? Home\n return (\n <button\n key={item.route}\n type=\"button\"\n onClick={() => onNavigate?.(item.route)}\n className={cn(\n 'flex flex-1 flex-col items-center justify-center gap-0.5 px-1 py-1 transition-colors',\n isActive ? 'text-primary' : 'text-muted-foreground',\n )}\n aria-current={isActive ? 'page' : undefined}\n >\n <Icon className=\"h-5 w-5\" />\n <span className=\"text-xs\">{item.label}</span>\n </button>\n )\n })}\n </nav>\n )\n}\n\n// ---------------------------------------------------------------------------\n// AppShell — main entry point\n// ---------------------------------------------------------------------------\n\nexport function AppShell({\n variant,\n contentFrame,\n navigation = [],\n logo,\n user,\n children,\n onNavigate,\n onSignOut,\n onProfile,\n onSettings,\n onBilling,\n userPlan,\n billingLabel,\n pageTitle,\n pageBack,\n currentPath,\n userMenuExtras,\n orgSwitcher,\n topbarStart,\n topbarEnd,\n sidebarTopContent,\n sidebarNavTop,\n sidebarFooterContent,\n bottomNav,\n onBottomNavAction,\n mobileHeader = 'minimal',\n userMenuSlot,\n notificationSlot,\n unreadCount = 0,\n searchLabel,\n sidebarSectionLabels,\n sidebarNavKey,\n sidebarNavDirection,\n sidebarNavChildConnector,\n rightRail,\n rightRailOpen = true,\n defaultRightRailWidth,\n onRightRailWidthChange,\n rightRailMinWidth,\n rightRailMaxWidth,\n rightRailResizeLabel,\n}: AppShellProps) {\n const hasBottomNav = !!bottomNav?.length\n const bottomBar = hasBottomNav ? (\n <MobileBottomNav\n items={bottomNav!}\n currentPath={currentPath}\n onNavigate={onNavigate}\n onAction={onBottomNavAction}\n />\n ) : null\n // Transparent mobile header → no bar, a floating avatar top-right instead.\n const floatingAvatar =\n mobileHeader === 'transparent' && user ? (\n <FloatingProfileAvatar user={user} onClick={onProfile} />\n ) : null\n\n let layoutElement: React.ReactNode\n switch (variant) {\n case 'sidebar':\n layoutElement = (\n <SidebarLayout\n navigation={navigation}\n logo={logo}\n user={user}\n onNavigate={onNavigate}\n onSignOut={onSignOut}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n userMenuExtras={userMenuExtras}\n orgSwitcher={orgSwitcher}\n sidebarTopContent={sidebarTopContent}\n sidebarNavTop={sidebarNavTop}\n sidebarFooterContent={sidebarFooterContent}\n frame={contentFrame}\n currentPath={currentPath}\n pageTitle={pageTitle}\n pageBack={pageBack}\n topbarStart={topbarStart}\n topbarEnd={topbarEnd}\n userMenuSlot={userMenuSlot}\n notificationSlot={notificationSlot}\n unreadCount={unreadCount}\n searchLabel={searchLabel}\n hasBottomNav={hasBottomNav}\n mobileHeader={mobileHeader}\n sidebarSectionLabels={sidebarSectionLabels}\n sidebarNavKey={sidebarNavKey}\n sidebarNavDirection={sidebarNavDirection}\n sidebarNavChildConnector={sidebarNavChildConnector}\n >\n {children}\n </SidebarLayout>\n )\n break\n\n case 'topbar':\n layoutElement = (\n <TopbarLayout\n navigation={navigation}\n logo={logo}\n user={user}\n onNavigate={onNavigate}\n onSignOut={onSignOut}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n userPlan={userPlan}\n billingLabel={billingLabel}\n userMenuExtras={userMenuExtras}\n orgSwitcher={orgSwitcher}\n frame={contentFrame}\n currentPath={currentPath}\n topbarStart={topbarStart}\n topbarEnd={topbarEnd}\n pageTitle={pageTitle}\n pageBack={pageBack}\n notificationSlot={notificationSlot}\n hasBottomNav={hasBottomNav}\n >\n {children}\n </TopbarLayout>\n )\n break\n\n case 'minimal':\n layoutElement = (\n <MinimalLayout logo={logo} user={user} headerEnd={topbarEnd}>\n {children}\n </MinimalLayout>\n )\n break\n\n default: {\n const _exhaustive: never = variant\n return null\n }\n }\n\n return (\n <>\n {rightRail ? (\n <SplitWithRightRail\n rail={rightRail}\n open={rightRailOpen}\n frame={contentFrame}\n defaultWidth={defaultRightRailWidth}\n onWidthChange={onRightRailWidthChange}\n minWidth={rightRailMinWidth}\n maxWidth={rightRailMaxWidth}\n resizeLabel={rightRailResizeLabel}\n >\n {layoutElement}\n </SplitWithRightRail>\n ) : (\n layoutElement\n )}\n {floatingAvatar}\n {bottomBar}\n </>\n )\n}\n\n// ---------------------------------------------------------------------------\n// SplitWithRightRail — the app on the left, a full-height rail on the right,\n// a divider the user owns between them.\n//\n// The layouts all root at `h-screen overflow-hidden`, so putting them in a\n// `flex-1 min-w-0` cell keeps their height and lets them shrink. `min-w-0` is\n// load-bearing: without it a flex child refuses to go below its content width\n// and the rail gets pushed off-screen instead of the content reflowing.\n// ---------------------------------------------------------------------------\n\nfunction SplitWithRightRail({\n children,\n rail,\n open,\n frame,\n defaultWidth = 380,\n onWidthChange,\n minWidth = 300,\n maxWidth = 720,\n resizeLabel = 'Resize panel',\n}: {\n children: React.ReactNode\n rail: React.ReactNode\n open: boolean\n /** Frame mode: the gutter between content and rail takes the sidebar tone,\n * the same surface the content card floats on. Without this the split shows\n * a bare strip of page background and the rail reads as bolted on. */\n frame?: boolean\n defaultWidth?: number\n onWidthChange?: (width: number) => void\n minWidth?: number\n maxWidth?: number\n resizeLabel?: string\n}) {\n const [width, setWidth] = React.useState(defaultWidth)\n const [dragging, setDragging] = React.useState(false)\n\n const clamp = React.useCallback(\n (value: number) => Math.min(maxWidth, Math.max(minWidth, value)),\n [minWidth, maxWidth],\n )\n\n // The app follows the pointer to the pixel, so the drag runs on window\n // listeners rather than on the handle: the cursor routinely outruns a 6px\n // target, and a resize that stops when you move too fast feels broken.\n React.useEffect(() => {\n if (!dragging) return\n const onMove = (event: PointerEvent) => {\n event.preventDefault()\n setWidth(clamp(window.innerWidth - event.clientX))\n }\n const stop = () => setDragging(false)\n window.addEventListener('pointermove', onMove)\n window.addEventListener('pointerup', stop)\n window.addEventListener('pointercancel', stop)\n // Text selection across the whole app while dragging a divider is pure\n // noise, and iframes/canvases would otherwise swallow the pointer.\n const previousSelect = document.body.style.userSelect\n const previousCursor = document.body.style.cursor\n document.body.style.userSelect = 'none'\n document.body.style.cursor = 'col-resize'\n return () => {\n window.removeEventListener('pointermove', onMove)\n window.removeEventListener('pointerup', stop)\n window.removeEventListener('pointercancel', stop)\n document.body.style.userSelect = previousSelect\n document.body.style.cursor = previousCursor\n }\n }, [dragging, clamp])\n\n // Report only on release: firing per pointer frame would write to\n // localStorage ~60×/second for one gesture.\n React.useEffect(() => {\n if (dragging) return\n onWidthChange?.(width)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [dragging])\n\n const nudge = (delta: number) => setWidth((current) => clamp(current + delta))\n\n return (\n // Sidebar tone always: the gutter and the divider sit in the shell's\n // chrome, next to the menu — painting them page-white put a bright strip\n // between the dark chrome and the rail, which read as a seam rather than\n // as space.\n <div className={cn('flex h-screen w-full overflow-hidden bg-sidebar', !frame && 'md:bg-background')}>\n <div className=\"min-w-0 flex-1\">{children}</div>\n\n {/* Divider — desktop only; on a phone the rail is a sheet over the app,\n and there is nothing to divide. */}\n <div\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={resizeLabel}\n aria-valuenow={width}\n aria-valuemin={minWidth}\n aria-valuemax={maxWidth}\n tabIndex={0}\n onPointerDown={(event) => {\n event.preventDefault()\n setDragging(true)\n }}\n onDoubleClick={() => setWidth(clamp(defaultWidth))}\n onKeyDown={(event) => {\n // Keyboard resize: a pointer-only divider makes the split view\n // unusable for anyone not using a mouse.\n if (event.key === 'ArrowLeft') { event.preventDefault(); nudge(24) }\n else if (event.key === 'ArrowRight') { event.preventDefault(); nudge(-24) }\n else if (event.key === 'Home') { event.preventDefault(); setWidth(maxWidth) }\n else if (event.key === 'End') { event.preventDefault(); setWidth(minWidth) }\n }}\n className={cn(\n 'group relative hidden w-1 shrink-0 cursor-col-resize focus-visible:outline-none',\n open && 'md:block',\n )}\n >\n {/* Invisible at rest: the gutter's own tone already separates the two\n panes, and a permanent rule there just adds a line to look at.\n It appears when you reach for it. */}\n <span\n className={cn(\n 'absolute inset-y-6 left-1/2 w-px -translate-x-1/2 rounded-full bg-transparent transition-colors',\n 'group-hover:bg-primary/60 group-focus-visible:bg-primary',\n dragging && 'bg-primary',\n )}\n />\n {/* Hit area wider than the line: 1px is honest visually and hostile\n to aim for. */}\n <span className=\"absolute inset-y-0 -left-1.5 -right-1.5\" />\n </div>\n\n {/* Rendered once: two copies would mount the rail's contents twice. On a\n phone the box collapses to zero width and the rail positions itself\n `fixed` over the screen. The frame inset is padding HERE rather than\n margin on the rail — a full-height child plus vertical margins\n overflows its own box. */}\n <aside\n style={{ ['--fayz-rail-w' as string]: `${width}px` }}\n className={cn(\n 'w-0 shrink-0 overflow-hidden',\n // Animating WIDTH is what makes the app glide back instead of\n // snapping; skipped mid-drag so the divider stays glued to the cursor.\n !dragging && 'motion-safe:transition-[width] motion-safe:duration-200 motion-safe:ease-out',\n open && 'md:w-[var(--fayz-rail-w)]',\n frame && 'md:py-2 md:pr-2',\n )}\n >\n {rail}\n </aside>\n </div>\n )\n}\n","import * as React from 'react'\nimport { cn } from '../lib/cn'\n\n// ---------------------------------------------------------------------------\n// AppShellSkeleton — what the admin shows while it is still booting (session\n// restore, plugin runtime, first paint).\n//\n// It used to draw the SHAPE of the shell: rail, header band, tiles, table. The\n// idea was that the app would resolve into its own outline. What it did in\n// practice was promise a specific screen and then contradict it — the outline\n// is a dashboard, and half the time you were opening something else — and the\n// pulsing bars read as content that failed to load rather than content on its\n// way. Worse, it made the wait look LONGER: a page of fake rows holds the eye,\n// so every extra frame of it registers.\n//\n// One spinner on the rail's own color says exactly as much (the app is coming)\n// and nothing false. It also matches the HTML boot screen the Vite plugin\n// injects (see @fayz-ai/sdk boot-skeleton), so the whole cold load is one\n// continuous image — same background, same spinner, in the same place — from\n// first paint to mounted app, with nothing swapping underneath.\n// ---------------------------------------------------------------------------\n\nexport interface AppShellSkeletonProps {\n /** Kept for API compatibility. The boot screen no longer draws a shell shape,\n * so every layout gets the same one. */\n variant?: 'sidebar' | 'topbar' | 'minimal'\n /** Kept for API compatibility; the boot screen has no content frame. */\n contentFrame?: boolean\n /** Kept for API compatibility; the boot screen shows no logo. */\n logo?: React.ReactNode\n /** What is loading, for screen readers. */\n label: string\n className?: string\n}\n\n/** Ring spinner in the rail's foreground tone. Static under reduced motion —\n * the ring alone still reads as \"busy\", a frozen spinner reads as \"stuck\". */\nexport function BootSpinner({ className }: { className?: string }) {\n return (\n <span\n aria-hidden\n className={cn(\n 'block h-7 w-7 animate-spin rounded-full border-2 border-sidebar-foreground/20 border-t-sidebar-foreground/70',\n 'motion-reduce:animate-none motion-reduce:border-t-sidebar-foreground/20 motion-reduce:animate-pulse',\n className,\n )}\n />\n )\n}\n\nexport function AppShellSkeleton({ label, className }: AppShellSkeletonProps) {\n return (\n <div\n role=\"status\"\n aria-busy=\"true\"\n className={cn('flex h-screen items-center justify-center overflow-hidden bg-sidebar', className)}\n >\n <span className=\"sr-only\">{label}</span>\n <BootSpinner />\n </div>\n )\n}\nAppShellSkeleton.displayName = 'AppShellSkeleton'\n","import * as React from 'react'\nimport { cn } from '../lib/cn'\n\n// ---------------------------------------------------------------------------\n// PageTransition — the single, SDK-owned animation applied to every nested\n// navigation (route changes in the shell + module-internal view changes).\n// Plugins never implement transitions themselves; they render content and the\n// shell/ModulePage wrap it in <PageTransition>. The style is provided app-wide\n// via NavTransitionProvider so different products/repos can ship a different\n// feel (slide | fade | none | future custom) without touching plugins.\n// ---------------------------------------------------------------------------\n\nexport type NavTransition = 'slide' | 'fade' | 'none'\n\nconst NavTransitionContext = React.createContext<NavTransition>('slide')\n\nexport function NavTransitionProvider({ value, children }: { value: NavTransition; children: React.ReactNode }) {\n return <NavTransitionContext.Provider value={value}>{children}</NavTransitionContext.Provider>\n}\n\nexport function useNavTransition(): NavTransition {\n return React.useContext(NavTransitionContext)\n}\n\nfunction resolveTransitionClass(transition: NavTransition, direction?: 'forward' | 'back'): string {\n if (transition === 'none') return ''\n if (transition === 'fade') return 'saas-page-enter'\n // slide (default) — direction-aware, falls back to a plain enter.\n if (direction === 'back') return 'saas-nav-back'\n if (direction === 'forward') return 'saas-nav-forward'\n return 'saas-page-enter'\n}\n\n/**\n * Wraps content and re-fires the active transition whenever `transitionKey`\n * changes (the key swap forces the node to remount, restarting the CSS\n * animation). Direction is optional and only used by the 'slide' transition.\n */\nexport function PageTransition({\n transitionKey,\n direction,\n className,\n children,\n}: {\n transitionKey: string | number\n direction?: 'forward' | 'back'\n className?: string\n children: React.ReactNode\n}) {\n const transition = useNavTransition()\n const animClass = resolveTransitionClass(transition, direction)\n return (\n <div key={transitionKey} className={cn(animClass, className)}>\n {children}\n </div>\n )\n}\n","import * as React from 'react'\nimport { createPortal } from 'react-dom'\nimport { ChevronDown, ChevronRight, ChevronLeft, Crown, type LucideIcon } from 'lucide-react'\nimport { useTranslation } from '@fayz-ai/core'\nimport { cn } from '../lib/cn'\nimport { ICON_MAP } from './Topbar'\nimport { useModuleHeaderActionsSlot } from './AppShell'\nimport { HeaderTabs, type HeaderTab } from '../primitives/header-tabs'\nimport { PageTransition } from './PageTransition'\nimport { useBackHandler } from './SaveBar'\nimport { usePageHeader, useHasPageHeaderHost, PageHeaderOutlet } from '../stores/page-header.store'\nimport { PageHeaderCrumb } from '../primitives/page-header'\nimport { useCrossModuleBack } from './useCrossModuleBack'\n\n// ---------------------------------------------------------------------------\n// PageHeaderActions — portals a page's primary action button(s) into the shell\n// top-bar's right-aligned actions slot. Falls back to a right-aligned inline row\n// when there's no slot (e.g. topbar layout). Any page can use it:\n// <PageHeaderActions><Button>New campaign</Button></PageHeaderActions>\n// ---------------------------------------------------------------------------\n\nexport function PageHeaderActions({ children }: { children: React.ReactNode }) {\n const slot = useModuleHeaderActionsSlot()\n if (slot) return createPortal(children, slot)\n return <div className=\"mb-4 flex items-center justify-end gap-2\">{children}</div>\n}\n\nexport interface ModuleNavItem {\n id: string\n label: string\n icon?: string\n active?: boolean\n onClick?: () => void\n /** Feature id for the access gate. When set, `useModuleNavAccess` (in\n * @fayz-ai/admin) resolves this link's role (hide) and plan (Crown) state. */\n feature?: string\n /** Freemium discovery: the user's role allows this link but their plan does\n * not entitle `feature`. Renders a small Crown badge (same vocabulary as the\n * Sidebar top-level nav); the click still navigates and the gated CONTENT\n * shows the UpgradePrompt. Typically set by `useModuleNavAccess`. */\n premium?: boolean\n children?: ModuleNavItem[]\n}\n\n// ---------------------------------------------------------------------------\n// PremiumBadge — the small Crown affordance shared by every module-nav renderer\n// (rail, mobile tabs, GHL header). Same vocabulary as the Sidebar top-level nav\n// so a plan-gated sub-module link reads identically wherever it appears.\n// ---------------------------------------------------------------------------\n\nfunction PremiumBadge({ className }: { className?: string }) {\n const t = useTranslation()\n const tip = t('upgrade.badgeTooltip')\n return (\n <span title={tip} aria-label={tip} className={cn('inline-flex shrink-0', className)}>\n <Crown className=\"h-3.5 w-3.5 text-amber-500\" aria-hidden />\n </span>\n )\n}\n\nexport interface ModulePageProps {\n title: string\n subtitle?: string\n nav: ModuleNavItem[]\n children: React.ReactNode\n className?: string\n /** Optional action element rendered next to the title (e.g. settings gear) */\n headerAction?: React.ReactNode\n /** Show the title/subtitle header. Default: true */\n showHeader?: boolean\n /** Optional content pinned to the bottom of the sidebar (e.g. \"Powered by X\") */\n sidebarFooter?: React.ReactNode\n /** How the module-internal nav renders. Falls back to the ModuleLayout context\n * (set by the app shell from its layout), then 'rail'. */\n navVariant?: ModuleNavVariant\n /** Active sub-view id — drives the SDK page transition when it changes.\n * Plugins pass their `useModuleNavigation().view`; they no longer animate themselves. */\n viewKey?: string\n /** Navigation direction for the transition (from `useModuleNavigation`). */\n direction?: 'forward' | 'back'\n}\n\n// ---------------------------------------------------------------------------\n// ModuleLayout context — lets the app shell decide how every module's internal\n// navigation renders ('rail' for topbar products, 'tabs' for sidebar/GHL-style\n// products), so plugins stay agnostic and products feel distinct.\n// ---------------------------------------------------------------------------\n\n/**\n * Onde a sub-navegação de um módulo mora.\n * rail — coluna à esquerda, dentro da página.\n * tabs — faixa de abas na primeira linha do corpo (HeaderTabs).\n * sidebar — em lugar nenhum da página: a sidebar da shell carrega as sub-views\n * como filhas do item do módulo. Para módulos cujas sub-views são\n * DESTINOS (Funil, Leads, Orçamentos) e não recortes de uma mesma\n * tela — listar as duas coisas seria a mesma navegação duas vezes.\n */\nexport type ModuleNavVariant = 'rail' | 'tabs' | 'sidebar'\n\nconst ModuleLayoutContext = React.createContext<ModuleNavVariant>('rail')\n\nexport function ModuleLayoutProvider({ variant, children }: { variant: ModuleNavVariant; children: React.ReactNode }) {\n return <ModuleLayoutContext.Provider value={variant}>{children}</ModuleLayoutContext.Provider>\n}\n\nexport function useModuleLayout(): ModuleNavVariant {\n return React.useContext(ModuleLayoutContext)\n}\n\nfunction NavItem({ item }: { item: ModuleNavItem }) {\n const [expanded, setExpanded] = React.useState(true)\n const Icon = item.icon ? (ICON_MAP[item.icon] ?? null) : null\n const hasChildren = item.children && item.children.length > 0\n const hasActiveChild = hasChildren && item.children!.some((c) => c.active)\n const isActive = item.active || hasActiveChild\n\n return (\n <div>\n <button\n type=\"button\"\n onClick={() => hasChildren ? setExpanded(!expanded) : item.onClick?.()}\n className={cn(\n 'flex items-center gap-2 w-full rounded-md px-2.5 py-1.5 text-sm transition-colors',\n isActive\n ? 'bg-primary/10 text-primary font-medium'\n : 'text-muted-foreground hover:text-foreground hover:bg-muted/50'\n )}\n >\n {Icon && <Icon className=\"h-4 w-4 shrink-0\" />}\n <span className=\"flex-1 text-left truncate\">{item.label}</span>\n {item.premium && <PremiumBadge className=\"ml-1\" />}\n {hasChildren && (\n expanded\n ? <ChevronDown className=\"h-3.5 w-3.5 shrink-0 opacity-50\" />\n : <ChevronRight className=\"h-3.5 w-3.5 shrink-0 opacity-50\" />\n )}\n </button>\n {hasChildren && expanded && (\n <div className=\"ml-4 mt-0.5 space-y-0.5 border-l pl-2\">\n {item.children!.map((child) => (\n <button\n key={child.id}\n type=\"button\"\n onClick={child.onClick}\n className={cn(\n 'flex items-center w-full rounded-md px-2.5 py-1 text-xs transition-colors',\n child.active\n ? 'text-primary font-medium bg-primary/5'\n : 'text-muted-foreground hover:text-foreground hover:bg-muted/50'\n )}\n >\n <span className=\"flex-1 text-left truncate\">{child.label}</span>\n {child.premium && <PremiumBadge className=\"ml-1\" />}\n </button>\n ))}\n </div>\n )}\n </div>\n )\n}\n\n/** Horizontal scrollable tabs for mobile — with expandable children */\nfunction MobileTabs({ nav }: { nav: ModuleNavItem[] }) {\n const scrollRef = React.useRef<HTMLDivElement>(null)\n const [expandedId, setExpandedId] = React.useState<string | null>(null)\n\n // Auto-scroll to active tab on mount\n React.useEffect(() => {\n const container = scrollRef.current\n if (!container) return\n const activeEl = container.querySelector('[data-active=\"true\"]') as HTMLElement\n if (activeEl) {\n const left = activeEl.offsetLeft - container.offsetWidth / 2 + activeEl.offsetWidth / 2\n container.scrollTo({ left: Math.max(0, left), behavior: 'smooth' })\n }\n }, [nav])\n\n return (\n <div className=\"md:hidden -mx-1 mb-4 no-print\">\n <div ref={scrollRef} className=\"flex gap-1 px-1 pb-2 overflow-x-auto scrollbar-none\">\n {nav.map((item) => {\n const Icon = item.icon ? (ICON_MAP[item.icon] ?? null) : null\n const hasChildren = item.children && item.children.length > 0\n const isActive = item.active || item.children?.some((c) => c.active)\n const isExpanded = expandedId === item.id\n\n return (\n <button\n key={item.id}\n type=\"button\"\n data-active={isActive || undefined}\n onClick={() => {\n if (hasChildren) {\n setExpandedId(isExpanded ? null : item.id)\n } else {\n item.onClick?.()\n setExpandedId(null)\n }\n }}\n className={cn(\n 'flex items-center gap-1.5 whitespace-nowrap rounded-full px-3 py-1.5 text-xs font-medium transition-colors shrink-0',\n isActive\n ? 'bg-primary text-primary-foreground'\n : 'bg-muted text-muted-foreground hover:text-foreground'\n )}\n >\n {Icon && <Icon className=\"h-3 w-3\" />}\n {item.label}\n {item.premium && <PremiumBadge />}\n {hasChildren && <ChevronDown className={cn('h-2.5 w-2.5 transition-transform', isExpanded && 'rotate-180')} />}\n </button>\n )\n })}\n </div>\n\n {/* Expanded children dropdown */}\n {expandedId && (() => {\n const item = nav.find((n) => n.id === expandedId)\n if (!item?.children) return null\n return (\n <div className=\"flex gap-1 px-2 pb-2 animate-in fade-in-0 slide-in-from-top-1\">\n {item.children.map((child) => (\n <button\n key={child.id}\n type=\"button\"\n onClick={() => { child.onClick?.(); setExpandedId(null) }}\n className={cn(\n 'whitespace-nowrap rounded-full px-2.5 py-1 text-[11px] font-medium transition-colors shrink-0',\n child.active\n ? 'bg-foreground/10 text-foreground'\n : 'text-muted-foreground hover:text-foreground'\n )}\n >\n {child.label}\n {child.premium && <PremiumBadge />}\n </button>\n ))}\n </div>\n )\n })()}\n </div>\n )\n}\n\n// ---------------------------------------------------------------------------\n// SubpageHeader\n// ---------------------------------------------------------------------------\n\n// ---------------------------------------------------------------------------\n// Back-button style — the SINGLE, app-wide affordance for returning from a\n// detail/subpage. Set once by the product via <BackStyleProvider>, NOT chosen\n// per-plugin (mirrors NavTransitionProvider for page transitions). Plugins just\n// pass `onBack` + `parentLabel` to SubpageHeader and inherit whatever style the\n// app picked:\n// 'link' → subtle \"← Back to {parent}\" above the title (default)\n// 'breadcrumb' → \"{parent} › Title\"\n// 'icon' → square chevron button beside the title\n// ---------------------------------------------------------------------------\n\nexport type BackButtonStyle = 'link' | 'breadcrumb' | 'icon'\n\nconst BackStyleContext = React.createContext<BackButtonStyle>('link')\n\nexport function BackStyleProvider({ style, children }: { style: BackButtonStyle; children: React.ReactNode }) {\n return <BackStyleContext.Provider value={style}>{children}</BackStyleContext.Provider>\n}\n\nexport function useBackStyle(): BackButtonStyle {\n return React.useContext(BackStyleContext)\n}\n\nexport interface SubpageHeaderProps {\n /** Page title */\n title: string\n /** Short description */\n subtitle?: string\n /** Lucide icon name */\n icon?: string\n /** Back button handler */\n onBack?: () => void\n /** Parent label (e.g. \"Invoices\") — used by every back style (\"Back to Invoices\", breadcrumb root, etc.) */\n parentLabel?: string\n /** Actions rendered on the right */\n actions?: React.ReactNode\n /** Override the app-wide back style for this one header. Rarely needed. */\n backStyle?: BackButtonStyle\n /** Keep the header where it renders instead of hoisting the back link into\n * the shell bar. For a detail opened INSIDE a tab the page never changed, so\n * the bar must keep saying where the user still is. */\n inline?: boolean\n}\n\nexport function SubpageHeader({ title, subtitle, icon, onBack, parentLabel, actions, backStyle, inline }: SubpageHeaderProps) {\n const t = useTranslation()\n const appStyle = useBackStyle()\n const hasShellBar = useHasPageHeaderHost() && !inline\n\n // Defer to the global navigation history when the user came from another\n // module, so the back link points at the actual previous page. Within the\n // same module the page's own onBack/parentLabel pass through unchanged.\n const cross = useCrossModuleBack(onBack, parentLabel)\n\n // …exceto quando o cabeçalho é `inline`. Aí ele não é uma PÁGINA: é um\n // detalhe aberto dentro de uma aba, e a rota nunca mudou. O histórico global\n // ainda aponta para de onde a pessoa veio ANTES de abrir a ficha — então,\n // quem chegasse ao cliente vindo da Agenda via, dentro da aba de gravações,\n // um \"← Voltar para Agenda\" que ao ser clicado saía do cliente inteiro em vez\n // de fechar a gravação. O voltar de um detalhe inline é sempre local.\n const effectiveOnBack = inline ? onBack : cross.onBack\n const effectiveParentLabel = inline ? parentLabel : cross.parentLabel\n\n // Wire this page's back action into the app-wide Escape key (no per-plugin code).\n useBackHandler(effectiveOnBack)\n const Icon = icon ? (ICON_MAP[icon] ?? null) : null\n\n // ---------------------------------------------------------------------------\n // Com barra de shell, o cabeçalho SOBE: \"← Título\" vai para a barra e aqui\n // fica só o que ela não carrega (subtítulo, ações).\n //\n // Era esta a origem do título duplicado — a barra escrevia \"Financeiro\" e a\n // página, uma linha abaixo, \"‹ Voltar para Contas a Pagar / Contas a Pagar\".\n // Três linhas para dizer duas coisas. Os estilos 'link' | 'breadcrumb' |\n // 'icon' continuam existindo para quem não tem barra (modal, layout minimal).\n // ---------------------------------------------------------------------------\n // Detalhe aberto DENTRO de uma aba: o mesmo \"← Pai / Título\" que a barra da\n // shell desenha, só que aqui, em tamanho de linha.\n //\n // Antes esta situação caía no estilo 'link', que é um cabeçalho de PÁGINA:\n // \"← Voltar para Gravações\" numa linha e, embaixo, um <h2 text-xl font-bold>.\n // Dentro da ficha do cliente isso dava dois títulos grandes empilhados — o\n // nome da pessoa e o da gravação — e um voltar com desenho que não existe em\n // nenhum outro lugar do app. `PageHeaderCrumb` é o MESMO componente do\n // \"← Clientes / Patricia Braga\" lá de cima: um desenho de voltar, não dois.\n if (inline && effectiveOnBack) {\n return (\n <div className=\"space-y-1\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <PageHeaderCrumb title={title} parentLabel={effectiveParentLabel} onBack={effectiveOnBack} />\n {actions && <div className=\"no-print\">{actions}</div>}\n </div>\n {subtitle && <p className=\"text-sm text-muted-foreground\">{subtitle}</p>}\n </div>\n )\n }\n\n if (hasShellBar) {\n return (\n <ShellSubpageHeader\n title={title}\n subtitle={subtitle}\n icon={Icon}\n onBack={effectiveOnBack}\n parentLabel={effectiveParentLabel}\n actions={actions}\n />\n )\n }\n // Breadcrumb/link need a parent label; without one we fall back to the icon button.\n const style: BackButtonStyle = !effectiveOnBack ? 'icon' : (backStyle ?? appStyle)\n const effectiveStyle: BackButtonStyle = style !== 'icon' && !effectiveParentLabel ? 'icon' : style\n\n const titleBlock = (\n <div className=\"flex items-center justify-between gap-4\">\n <div className=\"flex items-center gap-3\">\n {effectiveStyle === 'icon' && effectiveOnBack && (\n <button\n onClick={effectiveOnBack}\n className=\"flex h-8 w-8 items-center justify-center rounded-lg border hover:bg-muted bg-card shadow-button active:shadow-button-inset transition-colors\"\n >\n <ChevronLeft className=\"h-4 w-4\" />\n </button>\n )}\n {Icon && (\n <div className=\"flex h-10 w-10 items-center justify-center rounded-xl bg-muted\">\n <Icon className=\"h-5 w-5 text-muted-foreground\" />\n </div>\n )}\n <div>\n <h2 className=\"text-xl font-bold\">{title}</h2>\n {subtitle && <p className=\"text-sm text-muted-foreground\">{subtitle}</p>}\n </div>\n </div>\n {actions && <div className=\"no-print\">{actions}</div>}\n </div>\n )\n\n if (effectiveStyle === 'breadcrumb') {\n return (\n <div className=\"space-y-4 mb-6\">\n <div className=\"flex items-center justify-between gap-4\">\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <button onClick={effectiveOnBack} className=\"hover:text-foreground transition-colors\">{effectiveParentLabel}</button>\n <ChevronRight className=\"h-3.5 w-3.5\" />\n <span className=\"text-foreground font-medium\">{title}</span>\n </div>\n {actions && <div className=\"no-print\">{actions}</div>}\n </div>\n {subtitle && <p className=\"text-sm text-muted-foreground -mt-2\">{subtitle}</p>}\n </div>\n )\n }\n\n if (effectiveStyle === 'link') {\n return (\n <div className=\"space-y-3 mb-6\">\n <button\n onClick={effectiveOnBack}\n className=\"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors\"\n >\n <ChevronLeft className=\"h-4 w-4\" />\n {t('crud.detail.backTo', { entities: effectiveParentLabel as string })}\n </button>\n {titleBlock}\n </div>\n )\n }\n\n // icon (default fallback)\n return <div className=\"space-y-4 mb-6\">{titleBlock}</div>\n}\n\n/**\n * SubpageHeader quando existe barra de shell: o título e o voltar vão para a\n * barra; o corpo fica com o subtítulo e as ações — as duas coisas que a barra\n * não tem onde pôr.\n *\n * Renderiza um <div> vazio? Não: quando não sobra nada, não sobra elemento\n * nenhum, para a página não começar com uma margem fantasma.\n */\nfunction ShellSubpageHeader({\n title, subtitle, icon: Icon, onBack, parentLabel, actions,\n}: {\n title: string\n subtitle?: string\n icon: LucideIcon | null\n onBack?: () => void\n parentLabel?: string\n actions?: React.ReactNode\n}) {\n // Mesmo traço que PageHeader — \"← Pai / Título\".\n usePageHeader(\n <div className=\"flex min-w-0 items-center gap-2\">\n {Icon && !onBack && <Icon className=\"h-4 w-4 shrink-0 text-muted-foreground\" />}\n <PageHeaderCrumb title={title} parentLabel={parentLabel} onBack={onBack} />\n </div>,\n )\n\n if (!subtitle && !actions) return null\n return (\n <div className=\"mb-5 flex flex-wrap items-start justify-between gap-3\">\n {subtitle ? <p className=\"text-sm text-muted-foreground\">{subtitle}</p> : <span />}\n {actions && <div className=\"no-print flex shrink-0 items-center gap-2\">{actions}</div>}\n </div>\n )\n}\n\n// ---------------------------------------------------------------------------\n// ModuleHeader — a module's horizontal sub-nav (Painel · Funil · Leads · …).\n//\n// Renders the SAME `HeaderTabs` primitive, in the SAME place, as every list in\n// the app (CrudListView, OrderListView): the first row of the page body, tabs\n// on the left. It used to be underline-style tabs portalled into the shell's\n// top bar, which put it next to the page title — a second navigation surface,\n// in a different position and a different visual language from the tab strip\n// one click away on any list. One tab language, one position.\n// ---------------------------------------------------------------------------\n\nfunction ModuleHeader({ nav }: { nav: ModuleNavItem[] }) {\n // Tabs are flat: a parent with children navigates straight to its default\n // \"list\" view (sub-actions like \"New\" live as a button inside that list).\n function defaultChild(item: ModuleNavItem) {\n const kids = item.children ?? []\n return kids.find((c) => /list/i.test(c.id) || /^list$/i.test(c.label)) ?? kids[kids.length - 1]\n }\n\n const activeItem = nav.find((item) => item.active || item.children?.some((c) => c.active))\n\n const tabs: HeaderTab[] = nav.map((item) => ({\n value: item.id,\n label: item.label,\n icon: item.icon ? (ICON_MAP[item.icon] ?? undefined) : undefined,\n // Plan-gated views keep their upgrade marker — dropping it would hide the\n // only signal that the tab costs an upgrade.\n badge: item.premium ? <PremiumBadge /> : undefined,\n }))\n\n const onChange = (id: string) => {\n const item = nav.find((n) => n.id === id)\n if (!item) return\n const hasChildren = item.children && item.children.length > 0\n if (hasChildren) defaultChild(item)?.onClick?.()\n else item.onClick?.()\n }\n\n return (\n <div className=\"mb-6 flex flex-wrap items-center justify-between gap-3\">\n <HeaderTabs tabs={tabs} value={activeItem?.id ?? nav[0]?.id ?? ''} onChange={onChange} />\n </div>\n )\n}\n\n// ---------------------------------------------------------------------------\n// ModulePage\n// ---------------------------------------------------------------------------\n\nexport function ModulePage({ title, subtitle, nav, children, className, headerAction, showHeader = true, sidebarFooter, navVariant, viewKey, direction }: ModulePageProps) {\n const ctxVariant = useModuleLayout()\n const variant = navVariant ?? ctxVariant\n const transitionKey = viewKey ?? 'view'\n\n // Sidebar variant — the shell's sidebar lists this module's sub-views as\n // children of its nav entry, so the page renders NO sub-nav of its own.\n if (variant === 'sidebar') {\n return (\n <>\n {showHeader && headerAction && <PageHeaderActions>{headerAction}</PageHeaderActions>}\n <PageTransition transitionKey={transitionKey} direction={direction} className={cn('min-w-0', className)}>\n {children}\n </PageTransition>\n </>\n )\n }\n\n // Tabs variant — the module sub-nav is the first row of the content area (the\n // same slot and primitive every list uses), actions go to the shell's right\n // slot, and the shell owns the page title.\n if (variant === 'tabs') {\n return (\n <>\n <ModuleHeader nav={nav} />\n {/* Header actions belong to the module overview only; internal sub-views\n (showHeader=false) carry their own actions. */}\n {showHeader && headerAction && <PageHeaderActions>{headerAction}</PageHeaderActions>}\n <PageTransition transitionKey={transitionKey} direction={direction} className={cn('min-w-0', className)}>\n {children}\n </PageTransition>\n </>\n )\n }\n\n // Rail variant (default) — left sub-nav column.\n return (\n <div className={cn('flex gap-6 -mt-2', className)}>\n {/* Side navigation — hidden on mobile + print */}\n <div className=\"w-48 shrink-0 hidden md:block no-print\">\n <div className={cn(sidebarFooter && 'sticky top-4 flex flex-col')} style={sidebarFooter ? { height: 'calc(100vh - 8rem)' } : undefined}>\n <div>\n <p className=\"text-xs font-semibold text-muted-foreground uppercase tracking-wider px-2.5 mb-2\">{title}</p>\n <nav className=\"space-y-0.5\">\n {nav.map((item) => (\n <NavItem key={item.id} item={item} />\n ))}\n </nav>\n </div>\n {sidebarFooter && <div className=\"mt-auto\">{sidebarFooter}</div>}\n </div>\n </div>\n\n {/* Content */}\n <div className=\"flex-1 min-w-0\">\n {/* O cabeçalho da página mora AQUI, não na barra da shell: esta variante\n tem uma trilha lateral à esquerda, e uma barra com a largura toda\n passaria por cima dela — empurrando o menu do módulo para baixo do\n topo. A trilha tem prioridade para encostar no topo; a migalha\n pertence ao conteúdo que ela descreve. */}\n <PageHeaderOutlet />\n {showHeader && (\n <div className=\"mb-6 flex items-start justify-between gap-3\">\n <div>\n <h1 className=\"text-2xl font-bold\">{title}</h1>\n {subtitle && <p className=\"text-sm text-muted-foreground\">{subtitle}</p>}\n </div>\n {headerAction}\n </div>\n )}\n {/* Mobile tabs */}\n <MobileTabs nav={nav} />\n <PageTransition transitionKey={transitionKey} direction={direction}>\n {children}\n </PageTransition>\n </div>\n </div>\n )\n}\n","import * as React from 'react'\n\n// ---------------------------------------------------------------------------\n// PageTrail — quem é o PAI da tela que está desenhando agora.\n//\n// Uma migalha (\"← Entrega / Embalagens\") precisa de duas coisas que moram em\n// lugares diferentes: o nome do nível de cima, que só o container sabe, e o\n// nome do nível atual, que só a folha sabe. Sem um caminho entre os dois cada\n// container desenhava a própria seta \"para não perder o caminho de volta\" — e\n// foi assim que Configurações ficou com dois cabeçalhos empilhados: um da\n// barra da shell (\"Configurações\") e um escrito à mão dentro do plugin\n// (\"← Entrega\"), desalinhados, para uma coisa só.\n//\n// Aqui o container apenas DECLARA o nível dele. Quem desenha é sempre a folha,\n// uma vez só, pelo mesmo PageHeader que o resto do app usa — uma seta na tela,\n// nunca duas.\n// ---------------------------------------------------------------------------\n\nexport interface PageTrailCrumb {\n /** Nome do nível — a palavra antes da barra para quem vem abaixo. */\n label: string\n /** Rota (hash) deste nível. É também a IDENTIDADE dele: uma tela cuja rota é\n * igual à do nível não é filha dele, é ele — sem isso a lista de Locais,\n * que É a aba, viraria \"← Locais / Locais\". */\n href: string\n /** Como voltar. Sem isso, a própria rota. */\n onNavigate?: () => void\n}\n\nconst EMPTY: PageTrailCrumb[] = []\nconst PageTrailContext = React.createContext<PageTrailCrumb[]>(EMPTY)\n\n/** Declara um nível para tudo que renderizar abaixo. */\nexport function PageTrail({\n label,\n href,\n onNavigate,\n children,\n}: PageTrailCrumb & { children: React.ReactNode }) {\n const parent = React.useContext(PageTrailContext)\n // Identidade estável: a folha memoiza o nó do cabeçalho a partir daqui, e um\n // array novo a cada render faria a reivindicação da barra recomeçar sem fim.\n const trail = React.useMemo(\n () => [...parent, { label, href, onNavigate }],\n [parent, label, href, onNavigate],\n )\n return <PageTrailContext.Provider value={trail}>{children}</PageTrailContext.Provider>\n}\n\nexport function usePageTrail(): PageTrailCrumb[] {\n return React.useContext(PageTrailContext)\n}\n\n/**\n * O nível imediatamente acima de `href`, ou undefined quando não há trilha —\n * fora de Configurações a página segue sem migalha, como sempre foi.\n */\nexport function usePageTrailParent(href?: string): PageTrailCrumb | undefined {\n const trail = React.useContext(PageTrailContext)\n return React.useMemo(() => {\n const above = href ? trail.filter((c) => c.href !== href) : trail\n return above[above.length - 1]\n }, [trail, href])\n}\n\nexport function navigateToCrumb(crumb: PageTrailCrumb): void {\n if (crumb.onNavigate) crumb.onNavigate()\n else window.location.hash = crumb.href\n}\n","import * as React from 'react'\nimport { PanelRight, PanelRightClose, PanelRightOpen } from 'lucide-react'\nimport { cn } from '../lib/cn'\nimport { Button } from '../primitives/button'\nimport {\n Sheet, SheetContent, SheetHeader, SheetBody, SheetTitle, SheetDescription,\n} from '../primitives/sheet'\n\n// ---------------------------------------------------------------------------\n// ContentSplit — main content with a right-aligned companion panel, mobile\n// first. Below `lg` the aside lives in a right Sheet (opened by a trigger the\n// host places wherever fits — typically SubpageHeader actions, via\n// <ContentSplitTrigger/>). From `lg` up it docks as a sticky right column.\n//\n// Pairs with SubpageHeader/ModulePage: the page keeps its own back-button\n// header; ContentSplit only owns the columns below it. Reuse for any\n// \"document + operational panel\" page (script + shooting checklist, form +\n// help, detail + activity feed).\n// ---------------------------------------------------------------------------\n\ninterface ContentSplitContextValue {\n open: boolean\n setOpen: (open: boolean) => void\n}\n\nconst ContentSplitContext = React.createContext<ContentSplitContextValue | null>(null)\n\nexport interface ContentSplitProps {\n /** Main column (the document). */\n children: React.ReactNode\n /** Companion panel content (the checklist / help / activity). */\n aside: React.ReactNode\n /** Panel title — Sheet header on mobile, card header on desktop. */\n asideTitle: React.ReactNode\n /** Optional subtitle under the title. */\n asideDescription?: React.ReactNode\n /** Desktop column width (defaults to 20rem). */\n asideWidth?: string\n /** Controlled mobile-sheet state; uncontrolled when omitted. */\n asideOpen?: boolean\n onAsideOpenChange?: (open: boolean) => void\n /** Desktop column can collapse into a slim reopen rail. */\n collapsible?: boolean\n /** Initial desktop collapsed state (e.g. expand only on the relevant day). */\n defaultCollapsed?: boolean\n className?: string\n}\n\nexport function ContentSplit({\n children,\n aside,\n asideTitle,\n asideDescription,\n asideWidth = '20rem',\n asideOpen,\n onAsideOpenChange,\n collapsible = false,\n defaultCollapsed = false,\n className,\n}: ContentSplitProps) {\n const [internalOpen, setInternalOpen] = React.useState(false)\n const open = asideOpen ?? internalOpen\n const setOpen = onAsideOpenChange ?? setInternalOpen\n const [collapsed, setCollapsed] = React.useState(collapsible && defaultCollapsed)\n\n return (\n <ContentSplitContext.Provider value={{ open, setOpen }}>\n <div\n className={cn('lg:grid lg:items-start lg:gap-6', className)}\n style={{ gridTemplateColumns: `minmax(0, 1fr) ${collapsed ? 'auto' : asideWidth}` }}\n >\n <div className=\"min-w-0\">{children}</div>\n\n {/* Desktop: docked sticky column (or slim reopen rail when collapsed) */}\n <aside className=\"hidden lg:block lg:sticky lg:top-4\">\n {collapsed ? (\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => setCollapsed(false)}\n className=\"h-9 w-9 p-0\"\n aria-label={typeof asideTitle === 'string' ? asideTitle : undefined}\n title={typeof asideTitle === 'string' ? asideTitle : undefined}\n >\n <PanelRightOpen className=\"h-4 w-4\" />\n </Button>\n ) : (\n <div className=\"rounded-card border border-border bg-card\">\n <div className=\"flex items-start justify-between gap-2 border-b border-border px-4 py-3\">\n <div className=\"min-w-0\">\n <p className=\"text-sm font-semibold text-foreground\">{asideTitle}</p>\n {asideDescription && (\n <p className=\"mt-0.5 text-xs text-muted-foreground\">{asideDescription}</p>\n )}\n </div>\n {collapsible && (\n <button\n type=\"button\"\n onClick={() => setCollapsed(true)}\n className=\"rounded p-1 text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground\"\n aria-label=\"collapse\"\n >\n <PanelRightClose className=\"h-4 w-4\" />\n </button>\n )}\n </div>\n <div className=\"p-4\">{aside}</div>\n </div>\n )}\n </aside>\n </div>\n\n {/* Mobile: right sheet */}\n <div className=\"lg:hidden\">\n <Sheet open={open} onOpenChange={setOpen}>\n <SheetContent width=\"max-w-sm\">\n <SheetHeader>\n <SheetTitle>{asideTitle}</SheetTitle>\n {asideDescription && <SheetDescription>{asideDescription}</SheetDescription>}\n </SheetHeader>\n <SheetBody>{aside}</SheetBody>\n </SheetContent>\n </Sheet>\n </div>\n </ContentSplitContext.Provider>\n )\n}\n\nexport interface ContentSplitTriggerProps {\n /** Accessible label; also the visible text unless `iconOnly`. */\n label: React.ReactNode\n iconOnly?: boolean\n className?: string\n}\n\n/** Opens the mobile aside sheet. Renders nothing from `lg` up (the panel is\n * already docked). Place inside SubpageHeader `actions` or any toolbar. */\nexport function ContentSplitTrigger({ label, iconOnly, className }: ContentSplitTriggerProps) {\n const ctx = React.useContext(ContentSplitContext)\n if (!ctx) return null\n return (\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => ctx.setOpen(true)}\n className={cn('lg:hidden', className)}\n aria-label={typeof label === 'string' ? label : undefined}\n >\n <PanelRight className={cn('h-4 w-4', !iconOnly && 'mr-1.5')} />\n {!iconOnly && label}\n </Button>\n )\n}\n"]}
|