{"name":"analytics-dashboard","type":"registry:block","title":"Analytics Dashboard","description":"A complete SaaS analytics dashboard: KPI strip, revenue area chart, acquisition, conversion funnel, cohort retention heatmap, filterable customer table, and activity feed — plus the app shell (sidebar, mobile navigation, theme toggle) and typed mock data.","categories":["dashboard"],"docs":"Import \"honestui/charts.css\" once in your global stylesheet (before tailwindcss) so the charts are styled. The dashboard installs under app/(dashboard)/ — visit /dashboard. Dark mode: add suppressHydrationWarning to <html> in your root layout (the theme is applied on the client). Mock data lives in lib/dashboard/data.ts; replace it with your own data access. A ready-to-clone template of this dashboard lives at https://github.com/honestui/honestui-dashboard.","dependencies":["@tanstack/react-table","honestui"],"registryDependencies":["https://www.honestui.com/r/avatar.json","https://www.honestui.com/r/badge.json","https://www.honestui.com/r/button.json","https://www.honestui.com/r/card.json","https://www.honestui.com/r/data-table.json","https://www.honestui.com/r/dropdown-menu.json","https://www.honestui.com/r/empty.json","https://www.honestui.com/r/select.json","https://www.honestui.com/r/separator.json","https://www.honestui.com/r/sheet.json","https://www.honestui.com/r/skeleton.json","https://www.honestui.com/r/toggle-group.json"],"files":[{"path":"registry/default/blocks/analytics-dashboard/app/(dashboard)/analytics/page.tsx","type":"registry:page","target":"app/(dashboard)/analytics/page.tsx","content":"import type { Metadata } from \"next\";\n\nimport { PagePlaceholder } from \"@/components/dashboard/page-placeholder\";\n\nexport const metadata: Metadata = { title: \"Analytics\" };\n\nexport default function AnalyticsPage() {\n  return <PagePlaceholder title=\"Analytics\" />;\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/app/(dashboard)/customers/page.tsx","type":"registry:page","target":"app/(dashboard)/customers/page.tsx","content":"import type { Metadata } from \"next\";\n\nimport { PagePlaceholder } from \"@/components/dashboard/page-placeholder\";\n\nexport const metadata: Metadata = { title: \"Customers\" };\n\nexport default function CustomersPage() {\n  return <PagePlaceholder title=\"Customers\" />;\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/app/(dashboard)/dashboard/error.tsx","type":"registry:page","target":"app/(dashboard)/dashboard/error.tsx","content":"\"use client\";\n\nimport { Button } from \"@/components/ui/button\";\nimport {\n  Empty,\n  EmptyDescription,\n  EmptyHeader,\n  EmptyTitle,\n} from \"@/components/ui/empty\";\n\n/** Route-level error boundary for the dashboard. */\nexport default function DashboardError({\n  reset,\n}: {\n  error: Error & { digest?: string };\n  reset: () => void;\n}) {\n  return (\n    <div className=\"mx-auto w-full max-w-7xl px-4 py-6 sm:px-6 lg:px-8 lg:py-8\">\n      <Empty className=\"mt-24\">\n        <EmptyHeader>\n          <EmptyTitle>The dashboard couldn&apos;t be loaded</EmptyTitle>\n          <EmptyDescription>\n            Something went wrong while rendering this page.\n          </EmptyDescription>\n        </EmptyHeader>\n        <Button variant=\"outline\" onClick={reset}>\n          Try again\n        </Button>\n      </Empty>\n    </div>\n  );\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/app/(dashboard)/dashboard/loading.tsx","type":"registry:page","target":"app/(dashboard)/dashboard/loading.tsx","content":"import { Skeleton } from \"@/components/ui/skeleton\";\n\n/** Route-level loading state mirroring the dashboard's layout. */\nexport default function DashboardLoading() {\n  return (\n    <div className=\"mx-auto flex w-full max-w-7xl flex-col gap-10 px-4 py-6 sm:px-6 lg:px-8 lg:py-8\">\n      {/* Header */}\n      <div className=\"flex flex-wrap items-start justify-between gap-4\">\n        <div className=\"space-y-2\">\n          <Skeleton className=\"h-7 w-36\" />\n          <Skeleton className=\"h-4 w-72 max-w-full\" />\n        </div>\n        <div className=\"flex gap-2\">\n          <Skeleton className=\"h-8 w-36\" />\n          <Skeleton className=\"h-8 w-24\" />\n        </div>\n      </div>\n\n      {/* Metrics */}\n      <div className=\"grid grid-cols-2 gap-6 lg:grid-cols-4\">\n        {Array.from({ length: 4 }).map((_, i) => (\n          <div key={i} className=\"space-y-2\">\n            <Skeleton className=\"h-4 w-32 max-w-full\" />\n            <Skeleton className=\"h-8 w-24\" />\n            <Skeleton className=\"h-3.5 w-36 max-w-full\" />\n          </div>\n        ))}\n      </div>\n\n      {/* Revenue chart */}\n      <div className=\"space-y-5\">\n        <div className=\"flex flex-wrap items-end justify-between gap-3\">\n          <div className=\"space-y-2\">\n            <Skeleton className=\"h-5 w-24\" />\n            <Skeleton className=\"h-4 w-64 max-w-full\" />\n          </div>\n          <Skeleton className=\"h-8 w-72 max-w-full\" />\n        </div>\n        <Skeleton className=\"h-72 w-full sm:h-80\" />\n      </div>\n\n      {/* Two-column analytics */}\n      <div className=\"grid gap-10 lg:grid-cols-2 lg:gap-12\">\n        {Array.from({ length: 2 }).map((_, i) => (\n          <div key={i} className=\"space-y-5\">\n            <div className=\"space-y-2\">\n              <Skeleton className=\"h-5 w-28\" />\n              <Skeleton className=\"h-4 w-56 max-w-full\" />\n            </div>\n            <Skeleton className=\"h-56 w-full\" />\n          </div>\n        ))}\n      </div>\n\n      {/* Customers table */}\n      <div className=\"space-y-5\">\n        <div className=\"space-y-2\">\n          <Skeleton className=\"h-5 w-28\" />\n          <Skeleton className=\"h-4 w-56 max-w-full\" />\n        </div>\n        <div className=\"overflow-hidden rounded-lg border\">\n          <div className=\"border-b p-4\">\n            <Skeleton className=\"h-8 w-64 max-w-full\" />\n          </div>\n          <div className=\"space-y-3 p-4\">\n            {Array.from({ length: 8 }).map((_, i) => (\n              <Skeleton key={i} className=\"h-6 w-full\" />\n            ))}\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/app/(dashboard)/dashboard/page.tsx","type":"registry:page","target":"app/(dashboard)/dashboard/page.tsx","content":"import type { Metadata } from \"next\";\n\nimport { AcquisitionSection } from \"@/components/dashboard/acquisition-section\";\nimport { ConversionFunnel } from \"@/components/dashboard/conversion-funnel\";\nimport { CustomersSection } from \"@/components/dashboard/customers-section\";\nimport { DashboardHeader } from \"@/components/dashboard/dashboard-header\";\nimport { DateRangeProvider } from \"@/components/dashboard/date-range-context\";\nimport { MetricOverview } from \"@/components/dashboard/metric-overview\";\nimport { QuickInsight } from \"@/components/dashboard/quick-insight\";\nimport { RecentActivity } from \"@/components/dashboard/recent-activity\";\nimport { RetentionSection } from \"@/components/dashboard/retention-section\";\nimport { RevenueSection } from \"@/components/dashboard/revenue-section\";\n\nexport const metadata: Metadata = { title: \"Overview\" };\n\nexport default function DashboardPage() {\n  return (\n    <DateRangeProvider>\n      <div className=\"mx-auto flex w-full max-w-7xl flex-col gap-10 px-4 py-6 sm:px-6 lg:px-8 lg:py-8\">\n        <DashboardHeader />\n        <MetricOverview />\n        <RevenueSection />\n        <div className=\"grid gap-10 lg:grid-cols-2 lg:gap-12\">\n          <AcquisitionSection />\n          <ConversionFunnel />\n        </div>\n        <RetentionSection />\n        <CustomersSection />\n        <div className=\"grid gap-10 lg:grid-cols-[1fr_minmax(0,20rem)] lg:gap-12\">\n          <RecentActivity />\n          <QuickInsight />\n        </div>\n      </div>\n    </DateRangeProvider>\n  );\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/app/(dashboard)/layout.tsx","type":"registry:page","target":"app/(dashboard)/layout.tsx","content":"import type { ReactNode } from \"react\";\n\nimport { AppSidebar } from \"@/components/dashboard/app-sidebar\";\nimport { MobileHeader } from \"@/components/dashboard/mobile-header\";\n\n/**\n * Applies the stored (or system) theme before the dashboard paints so there\n * is no flash of the wrong theme. The theme lives in `data-theme` for\n * HonestUI tokens and the `dark` class for Tailwind variants and chart\n * theming. If your root layout already does this, remove the script here —\n * and either way, add `suppressHydrationWarning` to `<html>` in your root\n * layout since the theme is applied on the client.\n */\nconst themeInitScript = `(function () {\n  try {\n    var theme = localStorage.getItem(\"theme\");\n    if (theme !== \"light\" && theme !== \"dark\") {\n      theme = window.matchMedia(\"(prefers-color-scheme: dark)\").matches\n        ? \"dark\"\n        : \"light\";\n    }\n    var root = document.documentElement;\n    root.dataset.theme = theme;\n    root.classList.toggle(\"dark\", theme === \"dark\");\n    root.style.colorScheme = theme;\n  } catch (_) {}\n})();`;\n\nexport default function AppLayout({ children }: { children: ReactNode }) {\n  return (\n    <div className=\"flex min-h-dvh\">\n      <script dangerouslySetInnerHTML={{ __html: themeInitScript }} />\n      <AppSidebar />\n      <div className=\"flex min-w-0 flex-1 flex-col\">\n        <MobileHeader />\n        <main className=\"flex-1\">{children}</main>\n      </div>\n    </div>\n  );\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/app/(dashboard)/reports/page.tsx","type":"registry:page","target":"app/(dashboard)/reports/page.tsx","content":"import type { Metadata } from \"next\";\n\nimport { PagePlaceholder } from \"@/components/dashboard/page-placeholder\";\n\nexport const metadata: Metadata = { title: \"Reports\" };\n\nexport default function ReportsPage() {\n  return <PagePlaceholder title=\"Reports\" />;\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/app/(dashboard)/revenue/page.tsx","type":"registry:page","target":"app/(dashboard)/revenue/page.tsx","content":"import type { Metadata } from \"next\";\n\nimport { PagePlaceholder } from \"@/components/dashboard/page-placeholder\";\n\nexport const metadata: Metadata = { title: \"Revenue\" };\n\nexport default function RevenuePage() {\n  return <PagePlaceholder title=\"Revenue\" />;\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/app/(dashboard)/settings/page.tsx","type":"registry:page","target":"app/(dashboard)/settings/page.tsx","content":"import type { Metadata } from \"next\";\n\nimport { PagePlaceholder } from \"@/components/dashboard/page-placeholder\";\n\nexport const metadata: Metadata = { title: \"Settings\" };\n\nexport default function SettingsPage() {\n  return <PagePlaceholder title=\"Settings\" />;\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/components/dashboard/account-menu.tsx","type":"registry:component","target":"components/dashboard/account-menu.tsx","content":"\"use client\";\n\nimport { ChevronsUpDown } from \"honestui/icons\";\n\nimport { Avatar, AvatarFallback } from \"@/components/ui/avatar\";\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuGroup,\n  DropdownMenuItem,\n  DropdownMenuLabel,\n  DropdownMenuSeparator,\n  DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu\";\n\n/** Compact account area pinned to the bottom of the sidebar. */\nexport function AccountMenu() {\n  return (\n    <DropdownMenu>\n      <DropdownMenuTrigger\n        render={\n          <button\n            type=\"button\"\n            className=\"flex w-full items-center gap-2.5 rounded-md p-2 text-left transition-colors hover:bg-sidebar-accent focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring\"\n          />\n        }\n      >\n        <Avatar size=\"5\" color=\"indigo\">\n          <AvatarFallback>CO</AvatarFallback>\n        </Avatar>\n        <span className=\"flex min-w-0 flex-1 flex-col\">\n          <span className=\"truncate text-sm font-medium text-sidebar-foreground\">\n            Connor\n          </span>\n          <span className=\"truncate text-xs text-muted-foreground\">\n            Northstar HQ\n          </span>\n        </span>\n        <ChevronsUpDown\n          aria-hidden\n          className=\"size-4 shrink-0 text-muted-foreground\"\n        />\n      </DropdownMenuTrigger>\n      <DropdownMenuContent side=\"top\" align=\"start\" className=\"w-56\">\n        <DropdownMenuGroup>\n          <DropdownMenuLabel>\n            <span className=\"flex flex-col\">\n              Connor\n              <span className=\"text-xs font-normal text-muted-foreground\">\n                connor@northstar.app\n              </span>\n            </span>\n          </DropdownMenuLabel>\n        </DropdownMenuGroup>\n        <DropdownMenuSeparator />\n        <DropdownMenuItem\n          render={<a href=\"https://honestui.com/docs\" target=\"_blank\" rel=\"noreferrer\" />}\n        >\n          HonestUI docs\n        </DropdownMenuItem>\n        <DropdownMenuItem\n          render={\n            <a\n              href=\"https://github.com/honestui/honestui\"\n              target=\"_blank\"\n              rel=\"noreferrer\"\n            />\n          }\n        >\n          GitHub repository\n        </DropdownMenuItem>\n      </DropdownMenuContent>\n    </DropdownMenu>\n  );\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/components/dashboard/acquisition-section.tsx","type":"registry:component","target":"components/dashboard/acquisition-section.tsx","content":"\"use client\";\n\nimport { BarChart, type ChartConfig } from \"honestui/charts\";\n\nimport { acquisitionByRange } from \"@/lib/dashboard/data\";\nimport {\n  formatCompactNumber,\n  formatNumber,\n  formatPercent,\n} from \"@/lib/dashboard/format\";\nimport { useDateRange } from \"./date-range-context\";\n\nconst chartConfig = {\n  sessions: {\n    label: \"Sessions\",\n    colors: {\n      light: [\"var(--hui-color-viz-blue-9)\"],\n      dark: [\"var(--hui-color-viz-blue-9)\"],\n    },\n  },\n} satisfies ChartConfig;\n\nexport function AcquisitionSection() {\n  const { rangeKey } = useDateRange();\n  const channels = acquisitionByRange[rangeKey];\n\n  return (\n    <section aria-label=\"Acquisition\" className=\"flex min-w-0 flex-col\">\n      <h2 className=\"text-base font-semibold\">Acquisition</h2>\n      <p className=\"mt-0.5 text-sm text-muted-foreground\">\n        Sessions by channel over the selected period\n      </p>\n\n      <div className=\"mt-5 h-56 w-full\">\n        <BarChart\n          data={channels}\n          config={chartConfig}\n          xDataKey=\"channel\"\n          layout=\"horizontal\"\n          ariaLabel=\"Sessions by acquisition channel\"\n          className=\"h-full w-full\"\n        >\n          <BarChart.YAxis dataKey=\"channel\" />\n          <BarChart.XAxis\n            tickFormatter={(value) => formatCompactNumber(Number(value))}\n          />\n          <BarChart.Tooltip />\n          <BarChart.Bar dataKey=\"sessions\" />\n        </BarChart>\n      </div>\n\n      <div className=\"mt-4 border-t\">\n        <div\n          aria-hidden\n          className=\"grid grid-cols-[1fr_auto_auto] gap-x-6 pt-3 pb-1 text-xs text-muted-foreground\"\n        >\n          <span>Channel</span>\n          <span className=\"w-16 text-right\">Conv. rate</span>\n          <span className=\"w-20 text-right\">Customers</span>\n        </div>\n        <ul className=\"text-sm\">\n          {channels.map((channel) => (\n            <li\n              key={channel.channel}\n              className=\"grid grid-cols-[1fr_auto_auto] items-baseline gap-x-6 py-1.5\"\n            >\n              <span className=\"truncate\">{channel.channel}</span>\n              <span className=\"w-16 text-right tabular-nums text-muted-foreground\">\n                {formatPercent(channel.conversionRate)}\n              </span>\n              <span className=\"w-20 text-right tabular-nums\">\n                {formatNumber(channel.customers)}\n              </span>\n            </li>\n          ))}\n        </ul>\n      </div>\n    </section>\n  );\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/components/dashboard/app-sidebar.tsx","type":"registry:component","target":"components/dashboard/app-sidebar.tsx","content":"\"use client\";\n\nimport { useCallback, useEffect, useRef, useState, useSyncExternalStore } from \"react\";\nimport { PanelLeftClose, PanelLeftOpen } from \"honestui/icons\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Separator } from \"@/components/ui/separator\";\nimport { cn } from \"@/lib/utils\";\nimport { AccountMenu } from \"./account-menu\";\nimport { Brand } from \"./brand\";\nimport { SidebarNav } from \"./sidebar-nav\";\nimport { ThemeToggle } from \"./theme-toggle\";\n\nconst COLLAPSED_STORAGE_KEY = \"sidebar-collapsed\";\nconst COLLAPSED_CHANGE_EVENT = \"sidebar-collapsed-change\";\n\nfunction readStoredCollapsed(): boolean {\n  try {\n    return localStorage.getItem(COLLAPSED_STORAGE_KEY) === \"true\";\n  } catch {\n    return false;\n  }\n}\n\nfunction writeStoredCollapsed(next: boolean) {\n  try {\n    localStorage.setItem(COLLAPSED_STORAGE_KEY, String(next));\n  } catch {\n    // Storage can be unavailable; the toggle still works for this visit\n    // through the change event below.\n  }\n  window.dispatchEvent(new Event(COLLAPSED_CHANGE_EVENT));\n}\n\nfunction subscribeToCollapsed(onChange: () => void) {\n  window.addEventListener(COLLAPSED_CHANGE_EVENT, onChange);\n  window.addEventListener(\"storage\", onChange);\n  return () => {\n    window.removeEventListener(COLLAPSED_CHANGE_EVENT, onChange);\n    window.removeEventListener(\"storage\", onChange);\n  };\n}\n\n/**\n * The collapsed preference lives in localStorage so it survives visits.\n * useSyncExternalStore keeps server and client first paint consistent\n * (server snapshot: expanded) without setState-in-effect churn.\n */\nfunction useCollapsed() {\n  const collapsed = useSyncExternalStore(\n    subscribeToCollapsed,\n    readStoredCollapsed,\n    () => false,\n  );\n  const setCollapsed = useCallback(\n    (next: boolean) => writeStoredCollapsed(next),\n    [],\n  );\n  return [collapsed, setCollapsed] as const;\n}\n\nfunction SidebarContent({\n  collapsed,\n  onToggleCollapsed,\n}: {\n  collapsed: boolean;\n  onToggleCollapsed: () => void;\n}) {\n  return (\n    <>\n      <div className=\"flex items-center justify-between px-4 pt-5 pb-4\">\n        <Brand />\n        <div className=\"flex items-center gap-0.5\">\n          <ThemeToggle />\n          <Button\n            variant=\"ghost\"\n            size=\"icon-sm\"\n            aria-label={collapsed ? \"Expand sidebar\" : \"Collapse sidebar\"}\n            onClick={onToggleCollapsed}\n          >\n            {collapsed ? (\n              <PanelLeftOpen aria-hidden className=\"size-4\" />\n            ) : (\n              <PanelLeftClose aria-hidden className=\"size-4\" />\n            )}\n          </Button>\n        </div>\n      </div>\n      <div className=\"flex flex-1 flex-col overflow-y-auto px-2.5 pb-4\">\n        <SidebarNav />\n      </div>\n      <div className=\"px-2.5 pb-3\">\n        <Separator variant=\"secondary\" className=\"mb-3\" />\n        <AccountMenu />\n      </div>\n    </>\n  );\n}\n\n/**\n * Desktop sidebar — hidden below lg, where MobileHeader takes over.\n *\n * It can be collapsed out of the layout. While collapsed, moving the cursor\n * to the left edge of the screen (or tabbing into the sidebar) peeks it in\n * as an overlay; moving away hides it again. Expanding pins it back into\n * the layout. The choice persists across visits.\n */\nexport function AppSidebar() {\n  const [collapsed, setCollapsed] = useCollapsed();\n  const [peeking, setPeeking] = useState(false);\n  const hideTimer = useRef<number | null>(null);\n\n  useEffect(() => {\n    return () => {\n      if (hideTimer.current !== null) window.clearTimeout(hideTimer.current);\n    };\n  }, []);\n\n  function persistCollapsed(next: boolean) {\n    setCollapsed(next);\n    setPeeking(false);\n  }\n\n  function showPeek() {\n    if (hideTimer.current !== null) {\n      window.clearTimeout(hideTimer.current);\n      hideTimer.current = null;\n    }\n    setPeeking(true);\n  }\n\n  // A short delay keeps the overlay from flickering when the cursor briefly\n  // crosses its edge.\n  function hidePeek() {\n    if (hideTimer.current !== null) window.clearTimeout(hideTimer.current);\n    hideTimer.current = window.setTimeout(() => setPeeking(false), 150);\n  }\n\n  if (!collapsed) {\n    return (\n      <aside className=\"sticky top-0 hidden h-dvh w-60 shrink-0 flex-col border-r border-sidebar-border bg-sidebar lg:flex\">\n        <SidebarContent\n          collapsed={false}\n          onToggleCollapsed={() => persistCollapsed(true)}\n        />\n      </aside>\n    );\n  }\n\n  return (\n    <div className=\"hidden lg:block\">\n      {/* Hover target along the left edge of the screen. */}\n      <div\n        aria-hidden\n        className=\"fixed inset-y-0 left-0 z-40 w-2\"\n        onMouseEnter={showPeek}\n      />\n      <aside\n        className={cn(\n          \"fixed inset-y-0 left-0 z-40 flex w-60 -translate-x-full flex-col border-r border-sidebar-border bg-sidebar transition-transform duration-200 ease-out motion-reduce:transition-none\",\n          peeking && \"translate-x-0 shadow-lg\",\n        )}\n        onMouseEnter={showPeek}\n        onMouseLeave={hidePeek}\n        onFocusCapture={showPeek}\n        onBlurCapture={hidePeek}\n      >\n        <SidebarContent\n          collapsed\n          onToggleCollapsed={() => persistCollapsed(false)}\n        />\n      </aside>\n    </div>\n  );\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/components/dashboard/brand.tsx","type":"registry:component","target":"components/dashboard/brand.tsx","content":"import Link from \"next/link\";\n\nimport { cn } from \"@/lib/utils\";\n\n/** Compact Northstar wordmark used in the sidebar and mobile header. */\nexport function Brand({ className }: { className?: string }) {\n  return (\n    <Link\n      href=\"/dashboard\"\n      className={cn(\n        \"flex items-center gap-2 rounded-md font-medium text-foreground\",\n        className,\n      )}\n    >\n      <span\n        aria-hidden\n        className=\"flex size-6 items-center justify-center rounded-md bg-primary text-sm font-semibold text-primary-foreground\"\n      >\n        N\n      </span>\n      Northstar\n    </Link>\n  );\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/components/dashboard/chart-states.tsx","type":"registry:component","target":"components/dashboard/chart-states.tsx","content":"import { Button } from \"@/components/ui/button\";\nimport {\n  Empty,\n  EmptyDescription,\n  EmptyHeader,\n  EmptyTitle,\n} from \"@/components/ui/empty\";\nimport { cn } from \"@/lib/utils\";\n\n/** Shown in place of a chart when the selected period has no data. */\nexport function ChartEmptyState({ className }: { className?: string }) {\n  return (\n    <Empty className={cn(\"h-full justify-center\", className)}>\n      <EmptyHeader>\n        <EmptyTitle>No data for this period</EmptyTitle>\n        <EmptyDescription>\n          Try a different date range to see activity.\n        </EmptyDescription>\n      </EmptyHeader>\n    </Empty>\n  );\n}\n\n/**\n * Shown in place of a chart when its data fails to load. The starter's mock\n * data never fails; wire `onRetry` to your refetch when real data arrives.\n */\nexport function ChartErrorState({\n  message,\n  onRetry,\n  className,\n}: {\n  message: string;\n  onRetry?: () => void;\n  className?: string;\n}) {\n  return (\n    <Empty className={cn(\"h-full justify-center\", className)}>\n      <EmptyHeader>\n        <EmptyTitle>{message}</EmptyTitle>\n        <EmptyDescription>\n          Check your connection, then load the chart again.\n        </EmptyDescription>\n      </EmptyHeader>\n      {onRetry && (\n        <Button variant=\"outline\" size=\"sm\" onClick={onRetry}>\n          Try again\n        </Button>\n      )}\n    </Empty>\n  );\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/components/dashboard/conversion-funnel.tsx","type":"registry:component","target":"components/dashboard/conversion-funnel.tsx","content":"import { funnelStages } from \"@/lib/dashboard/data\";\nimport { formatNumber, formatPercent } from \"@/lib/dashboard/format\";\n\n/**\n * Funnel composed from primitives — HonestUI has no funnel chart, so bars\n * share one scale (percent of visitors) and each stage shows its conversion\n * from the previous one.\n */\nexport function ConversionFunnel() {\n  const max = funnelStages[0].value;\n\n  return (\n    <section aria-label=\"Conversion\" className=\"flex min-w-0 flex-col\">\n      <h2 className=\"text-base font-semibold\">Conversion</h2>\n      <p className=\"mt-0.5 text-sm text-muted-foreground\">\n        Visitor-to-customer funnel across the full journey\n      </p>\n\n      <ol className=\"mt-5 flex flex-1 flex-col justify-between gap-4\">\n        {funnelStages.map((stage, index) => {\n          const previous = index > 0 ? funnelStages[index - 1].value : null;\n          const stepRate = previous ? (stage.value / previous) * 100 : null;\n\n          return (\n            <li key={stage.stage}>\n              <div className=\"flex items-baseline justify-between gap-4 text-sm\">\n                <span>{stage.stage}</span>\n                <span className=\"flex items-baseline gap-2 tabular-nums\">\n                  {stepRate !== null && (\n                    <span className=\"text-xs text-muted-foreground\">\n                      {formatPercent(stepRate)} of previous\n                    </span>\n                  )}\n                  <span className=\"w-16 text-right font-medium\">\n                    {formatNumber(stage.value)}\n                  </span>\n                </span>\n              </div>\n              <div\n                role=\"presentation\"\n                className=\"mt-1.5 h-2 w-full overflow-hidden rounded-full bg-muted\"\n              >\n                <div\n                  className=\"h-full rounded-full bg-[var(--hui-color-background-accent-emphasis)]\"\n                  style={{ width: `${Math.max((stage.value / max) * 100, 1.5)}%` }}\n                />\n              </div>\n            </li>\n          );\n        })}\n      </ol>\n\n      <p className=\"mt-4 text-xs text-muted-foreground\">\n        {formatPercent((funnelStages.at(-1)!.value / max) * 100, 1)} of visitors\n        become paying customers end to end.\n      </p>\n    </section>\n  );\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/components/dashboard/customers-section.tsx","type":"registry:component","target":"components/dashboard/customers-section.tsx","content":"\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport type { ColumnDef, VisibilityState } from \"@tanstack/react-table\";\n\nimport { Avatar, AvatarFallback } from \"@/components/ui/avatar\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { DataTable } from \"@/components/ui/data-table/data-table\";\nimport {\n  Empty,\n  EmptyDescription,\n  EmptyHeader,\n  EmptyTitle,\n} from \"@/components/ui/empty\";\nimport { customers, healthStatuses, planNames } from \"@/lib/dashboard/data\";\nimport { formatCurrency, formatNumber } from \"@/lib/dashboard/format\";\nimport type { Customer, HealthStatus } from \"@/lib/dashboard/types\";\n\nconst healthBadgeVariant: Record<\n  HealthStatus,\n  \"success\" | \"warning\" | \"error\"\n> = {\n  Healthy: \"success\",\n  Watch: \"warning\",\n  \"At risk\": \"error\",\n};\n\nconst avatarColors = [\"indigo\", \"sky\", \"mint\", \"gold\", \"iris\"] as const;\n\nfunction avatarColor(name: string) {\n  let hash = 0;\n  for (const char of name) hash = (hash * 31 + char.charCodeAt(0)) % 997;\n  return avatarColors[hash % avatarColors.length];\n}\n\nconst columns: ColumnDef<Customer>[] = [\n  {\n    accessorKey: \"name\",\n    header: \"Customer\",\n    enableSorting: false,\n    enableHiding: false,\n    cell: ({ row }) => (\n      <span className=\"flex items-center gap-2.5\">\n        <Avatar size=\"4\" shape=\"rounded\" color={avatarColor(row.original.name)}>\n          <AvatarFallback>{row.original.name.charAt(0)}</AvatarFallback>\n        </Avatar>\n        <span className=\"font-medium\">{row.original.name}</span>\n      </span>\n    ),\n  },\n  {\n    accessorKey: \"plan\",\n    header: \"Plan\",\n    enableSorting: false,\n  },\n  {\n    accessorKey: \"mrr\",\n    header: \"MRR\",\n    meta: { align: \"right\" },\n    cell: ({ row }) => (\n      <span className=\"tabular-nums\">{formatCurrency(row.original.mrr)}</span>\n    ),\n  },\n  {\n    accessorKey: \"seats\",\n    header: \"Seats\",\n    enableSorting: false,\n    meta: { align: \"right\" },\n    cell: ({ row }) => (\n      <span className=\"tabular-nums\">{formatNumber(row.original.seats)}</span>\n    ),\n  },\n  {\n    accessorKey: \"health\",\n    header: \"Health\",\n    enableSorting: false,\n    cell: ({ row }) => (\n      <Badge variant={healthBadgeVariant[row.original.health]} size=\"sm\">\n        {row.original.health}\n      </Badge>\n    ),\n  },\n  {\n    accessorKey: \"lastActive\",\n    header: \"Last active\",\n    enableSorting: false,\n    cell: ({ row }) => (\n      <span className=\"text-muted-foreground\">{row.original.lastActive}</span>\n    ),\n  },\n];\n\nexport function CustomersSection() {\n  // Below md, drop the secondary columns instead of cramming six columns\n  // into a phone viewport. The toolbar's view menu can bring them back.\n  const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({});\n\n  useEffect(() => {\n    const query = window.matchMedia(\"(max-width: 767px)\");\n    const apply = () =>\n      setColumnVisibility(\n        query.matches ? { seats: false, lastActive: false } : {},\n      );\n    apply();\n    query.addEventListener(\"change\", apply);\n    return () => query.removeEventListener(\"change\", apply);\n  }, []);\n\n  return (\n    <section aria-label=\"Customers\">\n      <h2 className=\"text-base font-semibold\">Customers</h2>\n      <p className=\"mt-0.5 text-sm text-muted-foreground\">\n        Accounts ranked by recurring revenue\n      </p>\n\n      <div className=\"mt-5\">\n        <DataTable\n          columns={columns}\n          data={customers}\n          caption=\"Customer accounts\"\n          search={{ placeholder: \"Search customers...\" }}\n          filters={[\n            {\n              columnId: \"plan\",\n              title: \"Plan\",\n              options: planNames.map((plan) => ({ label: plan, value: plan })),\n            },\n            {\n              columnId: \"health\",\n              title: \"Health\",\n              options: healthStatuses.map((health) => ({\n                label: health,\n                value: health,\n              })),\n            },\n          ]}\n          pagination={{ pageSizeOptions: [10, 20] }}\n          columnVisibility={columnVisibility}\n          onColumnVisibilityChange={setColumnVisibility}\n          getRowId={(customer) => customer.id}\n          getRowLabel={(row) => row.original.name}\n          noResultsState={\n            <Empty className=\"p-10\">\n              <EmptyHeader>\n                <EmptyTitle>No customers found</EmptyTitle>\n                <EmptyDescription>\n                  Try changing your filters or search.\n                </EmptyDescription>\n              </EmptyHeader>\n            </Empty>\n          }\n        />\n      </div>\n    </section>\n  );\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/components/dashboard/dashboard-header.tsx","type":"registry:component","target":"components/dashboard/dashboard-header.tsx","content":"\"use client\";\n\nimport { Calendar, Download } from \"honestui/icons\";\n\nimport { Button } from \"@/components/ui/button\";\nimport {\n  Select,\n  SelectContent,\n  SelectItem,\n  SelectTrigger,\n  SelectValue,\n} from \"@/components/ui/select\";\nimport {\n  dateRangeOptions,\n  getRevenueSeries,\n  revenueMetricOptions,\n} from \"@/lib/dashboard/data\";\nimport type { DateRangeKey } from \"@/lib/dashboard/types\";\nimport { useDateRange } from \"./date-range-context\";\n\n/** Builds a CSV of every revenue series for the selected range. */\nfunction buildRevenueCsv(rangeKey: DateRangeKey): string {\n  const header = [\n    \"date\",\n    ...revenueMetricOptions.flatMap((option) => [\n      `${option.key}_current`,\n      `${option.key}_previous`,\n    ]),\n  ];\n  const series = revenueMetricOptions.map((option) =>\n    getRevenueSeries(rangeKey, option.key),\n  );\n  const rows = series[0].map((point, index) => [\n    point.date,\n    ...series.flatMap((s) => [s[index].current, s[index].previous]),\n  ]);\n  return [header, ...rows].map((row) => row.join(\",\")).join(\"\\n\");\n}\n\nexport function DashboardHeader() {\n  const { rangeKey, setRangeKey } = useDateRange();\n\n  function exportCsv() {\n    const blob = new Blob([buildRevenueCsv(rangeKey)], {\n      type: \"text/csv;charset=utf-8\",\n    });\n    const url = URL.createObjectURL(blob);\n    const link = document.createElement(\"a\");\n    link.href = url;\n    link.download = `northstar-revenue-${rangeKey}.csv`;\n    link.click();\n    URL.revokeObjectURL(url);\n  }\n\n  return (\n    <header className=\"flex flex-wrap items-start justify-between gap-x-6 gap-y-4\">\n      <div>\n        <h1 className=\"text-2xl font-semibold tracking-tight\">Overview</h1>\n        <p className=\"mt-1 text-sm text-muted-foreground\">\n          Monitor revenue, customers, and product activity.\n        </p>\n      </div>\n      <div className=\"flex flex-wrap items-center gap-2\">\n        <Select\n          value={rangeKey}\n          items={Object.fromEntries(\n            dateRangeOptions.map((option) => [option.key, option.label]),\n          )}\n          onValueChange={(value) => {\n            if (value) setRangeKey(value as DateRangeKey);\n          }}\n        >\n          <SelectTrigger size=\"small\" aria-label=\"Date range\">\n            <Calendar aria-hidden className=\"size-4 text-muted-foreground\" />\n            <SelectValue placeholder=\"Date range\" />\n          </SelectTrigger>\n          <SelectContent align=\"end\">\n            {dateRangeOptions.map((option) => (\n              <SelectItem key={option.key} value={option.key}>\n                {option.label}\n              </SelectItem>\n            ))}\n          </SelectContent>\n        </Select>\n        <Button variant=\"outline\" size=\"sm\" onClick={exportCsv}>\n          <Download aria-hidden className=\"size-4\" />\n          Export\n        </Button>\n      </div>\n    </header>\n  );\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/components/dashboard/date-range-context.tsx","type":"registry:component","target":"components/dashboard/date-range-context.tsx","content":"\"use client\";\n\nimport {\n  createContext,\n  useContext,\n  useMemo,\n  useState,\n  type ReactNode,\n} from \"react\";\n\nimport { dateRangeOptions, defaultDateRangeKey } from \"@/lib/dashboard/data\";\nimport type { DateRangeKey, DateRangeOption } from \"@/lib/dashboard/types\";\n\ninterface DateRangeContextValue {\n  rangeKey: DateRangeKey;\n  setRangeKey: (key: DateRangeKey) => void;\n  range: DateRangeOption;\n}\n\nconst DateRangeContext = createContext<DateRangeContextValue | null>(null);\n\n/** Shares the selected date range across the dashboard sections. */\nexport function DateRangeProvider({ children }: { children: ReactNode }) {\n  const [rangeKey, setRangeKey] = useState<DateRangeKey>(defaultDateRangeKey);\n\n  const value = useMemo<DateRangeContextValue>(\n    () => ({\n      rangeKey,\n      setRangeKey,\n      range:\n        dateRangeOptions.find((option) => option.key === rangeKey) ??\n        dateRangeOptions[1],\n    }),\n    [rangeKey],\n  );\n\n  return (\n    <DateRangeContext.Provider value={value}>\n      {children}\n    </DateRangeContext.Provider>\n  );\n}\n\nexport function useDateRange(): DateRangeContextValue {\n  const context = useContext(DateRangeContext);\n  if (!context) {\n    throw new Error(\"useDateRange must be used within DateRangeProvider\");\n  }\n  return context;\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/components/dashboard/metric-overview.tsx","type":"registry:component","target":"components/dashboard/metric-overview.tsx","content":"\"use client\";\n\nimport { TrendingDown, TrendingUp } from \"honestui/icons\";\n\nimport { cn } from \"@/lib/utils\";\nimport { metricsByRange } from \"@/lib/dashboard/data\";\nimport { useDateRange } from \"./date-range-context\";\n\n/**\n * The four headline metrics. Sentiment drives color, not the sign — a falling\n * churn rate renders as good news.\n */\nexport function MetricOverview() {\n  const { rangeKey, range } = useDateRange();\n  const metrics = metricsByRange[rangeKey];\n\n  return (\n    <section aria-label=\"Key metrics\">\n      <dl className=\"grid grid-cols-2 gap-x-6 gap-y-8 lg:grid-cols-4 lg:divide-x lg:divide-border\">\n        {metrics.map((metric) => {\n          const falling = metric.change.startsWith(\"-\");\n          const TrendIcon = falling ? TrendingDown : TrendingUp;\n\n          return (\n            <div key={metric.id} className=\"min-w-0 lg:px-6 lg:first:pl-0 lg:last:pr-0\">\n              <dt className=\"text-sm text-muted-foreground\">{metric.label}</dt>\n              <dd className=\"mt-1.5\">\n                <span className=\"text-2xl font-semibold tracking-tight tabular-nums\">\n                  {metric.value}\n                </span>\n                <span className=\"mt-1 flex flex-wrap items-baseline gap-x-1.5 text-xs\">\n                  <span\n                    className={cn(\n                      \"inline-flex items-center gap-1 font-medium tabular-nums\",\n                      metric.sentiment === \"positive\"\n                        ? \"text-[var(--hui-color-foreground-success-primary)]\"\n                        : \"text-[var(--hui-color-foreground-danger-primary)]\",\n                    )}\n                  >\n                    <TrendIcon aria-hidden className=\"size-3.5\" />\n                    {metric.change}\n                  </span>\n                  <span className=\"text-muted-foreground\">\n                    vs. {range.comparisonLabel}\n                  </span>\n                </span>\n              </dd>\n            </div>\n          );\n        })}\n      </dl>\n    </section>\n  );\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/components/dashboard/mobile-header.tsx","type":"registry:component","target":"components/dashboard/mobile-header.tsx","content":"\"use client\";\n\nimport { useState } from \"react\";\nimport { Menu } from \"honestui/icons\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Separator } from \"@/components/ui/separator\";\nimport {\n  Sheet,\n  SheetContent,\n  SheetDescription,\n  SheetHeader,\n  SheetTitle,\n  SheetTrigger,\n} from \"@/components/ui/sheet\";\nimport { AccountMenu } from \"./account-menu\";\nimport { Brand } from \"./brand\";\nimport { SidebarNav } from \"./sidebar-nav\";\nimport { ThemeToggle } from \"./theme-toggle\";\n\n/** Compact top bar with sheet navigation — shown below lg. */\nexport function MobileHeader() {\n  const [open, setOpen] = useState(false);\n\n  return (\n    <header className=\"sticky top-0 z-40 flex items-center gap-2 border-b bg-background px-4 py-2.5 lg:hidden\">\n      <Sheet open={open} onOpenChange={setOpen}>\n        <SheetTrigger\n          render={\n            <Button variant=\"ghost\" size=\"icon-sm\" aria-label=\"Open navigation\" />\n          }\n        >\n          <Menu aria-hidden className=\"size-4\" />\n        </SheetTrigger>\n        <SheetContent side=\"left\" className=\"w-72 p-0\">\n          <SheetHeader className=\"px-4 pt-4 pb-2\">\n            <SheetTitle>\n              <Brand />\n            </SheetTitle>\n            <SheetDescription className=\"sr-only\">\n              Main navigation\n            </SheetDescription>\n          </SheetHeader>\n          <div className=\"flex flex-1 flex-col overflow-y-auto px-2.5 pb-4\">\n            <SidebarNav onNavigate={() => setOpen(false)} />\n          </div>\n          <div className=\"px-2.5 pb-3\">\n            <Separator variant=\"secondary\" className=\"mb-3\" />\n            <AccountMenu />\n          </div>\n        </SheetContent>\n      </Sheet>\n      <Brand />\n      <div className=\"flex-1\" />\n      <ThemeToggle />\n    </header>\n  );\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/components/dashboard/nav.ts","type":"registry:component","target":"components/dashboard/nav.ts","content":"import type { ComponentType } from \"react\";\nimport {\n  ChartLine,\n  FileText,\n  LayoutDashboard,\n  LifeBuoy,\n  Settings,\n  Users,\n  Wallet,\n} from \"honestui/icons\";\n\nexport interface NavItem {\n  href: string;\n  label: string;\n  icon: ComponentType<{ className?: string; \"aria-hidden\"?: boolean }>;\n  external?: boolean;\n}\n\nexport const primaryNav: NavItem[] = [\n  { href: \"/dashboard\", label: \"Overview\", icon: LayoutDashboard },\n  { href: \"/analytics\", label: \"Analytics\", icon: ChartLine },\n  { href: \"/customers\", label: \"Customers\", icon: Users },\n  { href: \"/revenue\", label: \"Revenue\", icon: Wallet },\n  { href: \"/reports\", label: \"Reports\", icon: FileText },\n];\n\nexport const secondaryNav: NavItem[] = [\n  { href: \"/settings\", label: \"Settings\", icon: Settings },\n  {\n    href: \"https://honestui.com/docs\",\n    label: \"Help\",\n    icon: LifeBuoy,\n    external: true,\n  },\n];\n"},{"path":"registry/default/blocks/analytics-dashboard/components/dashboard/page-placeholder.tsx","type":"registry:component","target":"components/dashboard/page-placeholder.tsx","content":"import Link from \"next/link\";\n\nimport { Button } from \"@/components/ui/button\";\nimport {\n  Empty,\n  EmptyDescription,\n  EmptyHeader,\n  EmptyTitle,\n} from \"@/components/ui/empty\";\n\n/**\n * Stub for routes the starter intentionally leaves unbuilt. The Overview page\n * is the reference implementation; these keep the navigation honest without\n * shipping half-finished screens.\n */\nexport function PagePlaceholder({ title }: { title: string }) {\n  return (\n    <div className=\"mx-auto w-full max-w-6xl px-4 py-8 sm:px-6 lg:px-8\">\n      <h1 className=\"text-2xl font-semibold tracking-tight\">{title}</h1>\n      <Empty className=\"mt-24\">\n        <EmptyHeader>\n          <EmptyTitle>This page is yours to build</EmptyTitle>\n          <EmptyDescription>\n            The starter ships the Overview page as its reference\n            implementation. Reuse its sections and data patterns to build out\n            {\" \"}\n            {title}.\n          </EmptyDescription>\n        </EmptyHeader>\n        <Button variant=\"outline\" render={<Link href=\"/dashboard\" />}>\n          View overview\n        </Button>\n      </Empty>\n    </div>\n  );\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/components/dashboard/quick-insight.tsx","type":"registry:component","target":"components/dashboard/quick-insight.tsx","content":"import { TrendingUp } from \"honestui/icons\";\n\nimport { Card, CardHeader, CardPanel, CardTitle } from \"@/components/ui/card\";\nimport { Separator } from \"@/components/ui/separator\";\nimport { quickInsight } from \"@/lib/dashboard/data\";\nimport { formatCurrency } from \"@/lib/dashboard/format\";\n\nexport function QuickInsight() {\n  return (\n    <section aria-label=\"Insight\" className=\"flex min-w-0\">\n      <Card variant=\"soft\" className=\"w-full gap-2.5 py-5\">\n        <CardHeader className=\"px-5\">\n          <CardTitle className=\"flex items-center gap-2 text-sm font-semibold\">\n            <TrendingUp\n              aria-hidden\n              className=\"size-4 shrink-0 text-[var(--hui-color-foreground-success-primary)]\"\n            />\n            {quickInsight.headline}\n          </CardTitle>\n        </CardHeader>\n        <CardPanel className=\"flex flex-1 flex-col px-5\">\n          <p className=\"text-sm leading-6 text-muted-foreground\">\n            {quickInsight.detail}\n          </p>\n          <Separator variant=\"secondary\" className=\"mt-4 mb-1\" />\n          <ul className=\"flex flex-1 flex-col justify-evenly text-sm\">\n            {quickInsight.breakdown.map((item) => (\n              <li\n                key={item.label}\n                className=\"flex items-baseline justify-between gap-4 py-1.5\"\n              >\n                <span className=\"text-muted-foreground\">{item.label}</span>\n                <span className=\"font-medium tabular-nums\">\n                  {formatCurrency(item.mrr)}\n                </span>\n              </li>\n            ))}\n          </ul>\n        </CardPanel>\n      </Card>\n    </section>\n  );\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/components/dashboard/recent-activity.tsx","type":"registry:component","target":"components/dashboard/recent-activity.tsx","content":"import type { ComponentType } from \"react\";\nimport {\n  ArrowDownRight,\n  ArrowUpRight,\n  CirclePlus,\n  RefreshCw,\n  UserPlus,\n} from \"honestui/icons\";\n\nimport { recentActivity } from \"@/lib/dashboard/data\";\nimport type { ActivityKind } from \"@/lib/dashboard/types\";\n\ntype IconComponent = ComponentType<{\n  className?: string;\n  \"aria-hidden\"?: boolean;\n}>;\n\nconst kindIcons: Record<ActivityKind, IconComponent> =\n  {\n    upgrade: ArrowUpRight,\n    expansion: CirclePlus,\n    renewal: RefreshCw,\n    contraction: ArrowDownRight,\n    trial: UserPlus,\n  };\n\nexport function RecentActivity() {\n  return (\n    <section aria-label=\"Recent activity\" className=\"min-w-0\">\n      <h2 className=\"text-base font-semibold\">Recent activity</h2>\n      <p className=\"mt-0.5 text-sm text-muted-foreground\">\n        Latest account events across the workspace\n      </p>\n\n      <ul className=\"mt-4 divide-y divide-border\">\n        {recentActivity.map((item) => {\n          const Icon = kindIcons[item.kind];\n          return (\n            <li key={item.id} className=\"flex items-center gap-3 py-2.5\">\n              <Icon\n                aria-hidden\n                className=\"size-4 shrink-0 text-muted-foreground\"\n              />\n              <p className=\"min-w-0 flex-1 truncate text-sm\">\n                <span className=\"font-medium\">{item.customer}</span>{\" \"}\n                <span className=\"text-muted-foreground\">\n                  {item.event.charAt(0).toLowerCase() + item.event.slice(1)}\n                </span>\n              </p>\n              <span className=\"shrink-0 text-xs text-muted-foreground\">\n                {item.time}\n              </span>\n            </li>\n          );\n        })}\n      </ul>\n    </section>\n  );\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/components/dashboard/retention-section.tsx","type":"registry:component","target":"components/dashboard/retention-section.tsx","content":"\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { Heatmap, type ChartConfig } from \"honestui/charts\";\n\nimport { retentionCohorts } from \"@/lib/dashboard/data\";\nimport { formatPercent } from \"@/lib/dashboard/format\";\n\nconst chartConfig = {\n  retention: {\n    label: \"Retention\",\n    colors: {\n      light: [\n        \"var(--hui-color-viz-iris-6)\",\n        \"var(--hui-color-viz-iris-8)\",\n        \"var(--hui-color-viz-iris-9)\",\n        \"var(--hui-color-viz-iris-11)\",\n      ],\n      dark: [\n        \"var(--hui-color-viz-iris-6)\",\n        \"var(--hui-color-viz-iris-8)\",\n        \"var(--hui-color-viz-iris-9)\",\n        \"var(--hui-color-viz-iris-11)\",\n      ],\n    },\n  },\n} satisfies ChartConfig;\n\nexport function RetentionSection() {\n  // In-cell percentages get cramped on phones; the tooltip still carries the\n  // exact values there.\n  const [showValues, setShowValues] = useState(true);\n\n  useEffect(() => {\n    const query = window.matchMedia(\"(min-width: 640px)\");\n    const apply = () => setShowValues(query.matches);\n    apply();\n    query.addEventListener(\"change\", apply);\n    return () => query.removeEventListener(\"change\", apply);\n  }, []);\n\n  return (\n    <section aria-label=\"Retention\">\n      <h2 className=\"text-base font-semibold\">Retention</h2>\n      <p className=\"mt-0.5 text-sm text-muted-foreground\">\n        Percentage of each signup cohort still active in subsequent weeks.\n      </p>\n\n      <div className=\"mt-5 h-80 w-full\">\n        <Heatmap\n          data={retentionCohorts}\n          config={chartConfig}\n          xDataKey=\"week\"\n          yDataKey=\"cohort\"\n          valueDataKey=\"retention\"\n          min={50}\n          max={100}\n          ariaLabel=\"Weekly retention by signup cohort, week zero through week eight\"\n          className=\"h-full w-full\"\n        >\n          <Heatmap.XAxis />\n          <Heatmap.YAxis inverse />\n          <Heatmap.Legend\n            minLabel=\"50%\"\n            maxLabel=\"100%\"\n            valueFormatter={(value) => formatPercent(value, 0)}\n          />\n          <Heatmap.Tooltip\n            valueFormatter={(value) => `${formatPercent(value)} retained`}\n          />\n          <Heatmap.Cells\n            showValues={showValues}\n            valueFormatter={(value) => formatPercent(value, 0)}\n          />\n        </Heatmap>\n      </div>\n    </section>\n  );\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/components/dashboard/revenue-section.tsx","type":"registry:component","target":"components/dashboard/revenue-section.tsx","content":"\"use client\";\n\nimport { useState } from \"react\";\nimport { AreaChart, type ChartConfig } from \"honestui/charts\";\n\nimport { Toggle, ToggleGroup } from \"@/components/ui/toggle-group\";\nimport { getRevenueSeries, revenueMetricOptions } from \"@/lib/dashboard/data\";\nimport { formatCompactCurrency } from \"@/lib/dashboard/format\";\nimport type { RevenueMetricKey } from \"@/lib/dashboard/types\";\nimport { ChartEmptyState } from \"./chart-states\";\nimport { useDateRange } from \"./date-range-context\";\n\nconst chartConfig = {\n  current: {\n    label: \"This period\",\n    colors: {\n      light: [\"var(--hui-color-viz-iris-9)\"],\n      dark: [\"var(--hui-color-viz-iris-9)\"],\n    },\n  },\n  // The comparison series reads as a reference line, so it uses the muted\n  // foreground token instead of a second data color.\n  previous: {\n    label: \"Previous period\",\n    colors: {\n      light: [\"var(--hui-color-foreground-base-tertiary)\"],\n      dark: [\"var(--hui-color-foreground-base-tertiary)\"],\n    },\n  },\n} satisfies ChartConfig;\n\nexport function RevenueSection() {\n  const { rangeKey, range } = useDateRange();\n  const [metric, setMetric] = useState<RevenueMetricKey>(\"revenue\");\n\n  const series = getRevenueSeries(rangeKey, metric);\n  const metricLabel =\n    revenueMetricOptions.find((option) => option.key === metric)?.label ??\n    \"Revenue\";\n\n  return (\n    <section aria-label=\"Revenue\">\n      <div className=\"flex flex-wrap items-end justify-between gap-x-6 gap-y-3\">\n        <div>\n          <h2 className=\"text-base font-semibold\">Revenue</h2>\n          <p className=\"mt-0.5 text-sm text-muted-foreground\">\n            Recurring revenue over the selected period\n          </p>\n        </div>\n        <ToggleGroup\n          aria-label=\"Revenue metric\"\n          value={[metric]}\n          onValueChange={(groupValue: unknown[]) => {\n            const next = groupValue[0];\n            if (typeof next === \"string\") {\n              setMetric(next as RevenueMetricKey);\n            }\n          }}\n        >\n          {revenueMetricOptions.map((option) => (\n            <Toggle\n              key={option.key}\n              value={option.key}\n              className=\"px-1\"\n              aria-label={option.label}\n            >\n              <span className=\"px-2\">{option.label}</span>\n            </Toggle>\n          ))}\n        </ToggleGroup>\n      </div>\n\n      <div className=\"mt-5 h-72 w-full sm:h-80\">\n        {series.length === 0 ? (\n          <ChartEmptyState />\n        ) : (\n          <AreaChart\n            data={series}\n            config={chartConfig}\n            xDataKey=\"label\"\n            curveType=\"monotone\"\n            ariaLabel={`${metricLabel} for the ${range.label.toLowerCase()} compared with the ${range.comparisonLabel}`}\n            className=\"h-full w-full\"\n          >\n            <AreaChart.Grid />\n            <AreaChart.XAxis dataKey=\"label\" />\n            <AreaChart.YAxis\n              tickFormatter={(value) => formatCompactCurrency(value)}\n            />\n            <AreaChart.Tooltip />\n            <AreaChart.Legend align=\"right\" verticalAlign=\"top\" />\n            <AreaChart.Area\n              dataKey=\"previous\"\n              variant=\"none\"\n              strokeVariant=\"dashed\"\n            />\n            <AreaChart.Area\n              dataKey=\"current\"\n              variant=\"gradient\"\n              strokeVariant=\"solid\"\n            />\n          </AreaChart>\n        )}\n      </div>\n    </section>\n  );\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/components/dashboard/sidebar-nav.tsx","type":"registry:component","target":"components/dashboard/sidebar-nav.tsx","content":"\"use client\";\n\nimport Link from \"next/link\";\nimport { usePathname } from \"next/navigation\";\n\nimport { cn } from \"@/lib/utils\";\nimport { primaryNav, secondaryNav, type NavItem } from \"./nav\";\n\nfunction NavLink({\n  item,\n  onNavigate,\n}: {\n  item: NavItem;\n  onNavigate?: () => void;\n}) {\n  const pathname = usePathname();\n  const isActive = !item.external && pathname === item.href;\n  const Icon = item.icon;\n\n  const className = cn(\n    \"flex items-center gap-2.5 rounded-md px-2.5 py-1.5 text-sm text-sidebar-foreground/75 transition-colors\",\n    \"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground\",\n    \"focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring\",\n    isActive && \"bg-sidebar-accent font-medium text-sidebar-accent-foreground\",\n  );\n\n  if (item.external) {\n    return (\n      <a\n        href={item.href}\n        target=\"_blank\"\n        rel=\"noreferrer\"\n        className={className}\n      >\n        <Icon aria-hidden className=\"size-4 shrink-0\" />\n        {item.label}\n      </a>\n    );\n  }\n\n  return (\n    <Link\n      href={item.href}\n      aria-current={isActive ? \"page\" : undefined}\n      className={className}\n      onClick={onNavigate}\n    >\n      <Icon aria-hidden className=\"size-4 shrink-0\" />\n      {item.label}\n    </Link>\n  );\n}\n\n/** Primary + secondary navigation, shared by the sidebar and mobile sheet. */\nexport function SidebarNav({ onNavigate }: { onNavigate?: () => void }) {\n  return (\n    <nav\n      aria-label=\"Main navigation\"\n      className=\"flex flex-1 flex-col justify-between gap-8\"\n    >\n      <ul className=\"flex flex-col gap-0.5\">\n        {primaryNav.map((item) => (\n          <li key={item.href}>\n            <NavLink item={item} onNavigate={onNavigate} />\n          </li>\n        ))}\n      </ul>\n      <ul className=\"flex flex-col gap-0.5\">\n        {secondaryNav.map((item) => (\n          <li key={item.href}>\n            <NavLink item={item} onNavigate={onNavigate} />\n          </li>\n        ))}\n      </ul>\n    </nav>\n  );\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/components/dashboard/theme-toggle.tsx","type":"registry:component","target":"components/dashboard/theme-toggle.tsx","content":"\"use client\";\n\nimport { Moon, Sun } from \"honestui/icons\";\n\nimport { Button } from \"@/components/ui/button\";\n\n/**\n * Switches between light and dark by updating `data-theme` (HonestUI tokens)\n * and the `dark` class (Tailwind variants + chart themes) on <html>. The\n * icons swap via CSS so server and client markup always match.\n */\nexport function ThemeToggle({ className }: { className?: string }) {\n  function toggleTheme() {\n    const root = document.documentElement;\n    const next = root.dataset.theme === \"dark\" ? \"light\" : \"dark\";\n    root.dataset.theme = next;\n    root.classList.toggle(\"dark\", next === \"dark\");\n    root.style.colorScheme = next;\n    try {\n      localStorage.setItem(\"theme\", next);\n    } catch {\n      // Storage can be unavailable (private mode); the toggle still works.\n    }\n  }\n\n  return (\n    <Button\n      variant=\"ghost\"\n      size=\"icon-sm\"\n      aria-label=\"Toggle theme\"\n      className={className}\n      onClick={toggleTheme}\n    >\n      <Sun aria-hidden className=\"size-4 dark:hidden\" />\n      <Moon aria-hidden className=\"hidden size-4 dark:block\" />\n    </Button>\n  );\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/lib/dashboard/data.ts","type":"registry:lib","target":"lib/dashboard/data.ts","content":"import type {\n  AcquisitionChannel,\n  ActivityEvent,\n  Customer,\n  DateRangeKey,\n  DateRangeOption,\n  FunnelStage,\n  Insight,\n  Metric,\n  RetentionCell,\n  RevenueMetricKey,\n  RevenueMetricOption,\n  RevenuePoint,\n} from \"./types\";\n\n/**\n * All dashboard data is deterministic mock data. Series are generated once at\n * module load from fixed seeds, so values never change between renders.\n * Replace this module with real data access when building on the template.\n */\n\n/** Fixed \"today\" for the mock data set, so dates are stable. */\nconst ANCHOR = new Date(\"2026-08-31T00:00:00\");\n\nconst DAY = 24 * 60 * 60 * 1000;\n\n/** Small deterministic PRNG (mulberry32). */\nfunction seededRandom(seed: number) {\n  let state = seed >>> 0;\n  return () => {\n    state = (state + 0x6d2b79f5) >>> 0;\n    let t = state;\n    t = Math.imul(t ^ (t >>> 15), t | 1);\n    t ^= t + Math.imul(t ^ (t >>> 7), t | 61);\n    return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n  };\n}\n\nfunction isoDate(date: Date): string {\n  return date.toISOString().slice(0, 10);\n}\n\nfunction daysAgo(days: number): Date {\n  return new Date(ANCHOR.getTime() - days * DAY);\n}\n\nexport const dateRangeOptions: DateRangeOption[] = [\n  { key: \"7d\", label: \"Last 7 days\", comparisonLabel: \"previous 7 days\" },\n  { key: \"30d\", label: \"Last 30 days\", comparisonLabel: \"previous 30 days\" },\n  { key: \"90d\", label: \"Last 90 days\", comparisonLabel: \"previous 90 days\" },\n  { key: \"ytd\", label: \"This year\", comparisonLabel: \"last year\" },\n];\n\nexport const defaultDateRangeKey: DateRangeKey = \"30d\";\n\nexport const revenueMetricOptions: RevenueMetricOption[] = [\n  { key: \"revenue\", label: \"Revenue\" },\n  { key: \"new-mrr\", label: \"New MRR\" },\n  { key: \"expansion\", label: \"Expansion\" },\n  { key: \"churned\", label: \"Churned\" },\n];\n\n/* ------------------------------------------------------------------ */\n/* Metrics                                                             */\n/* ------------------------------------------------------------------ */\n\nfunction buildMetrics(\n  mrrChange: string,\n  customersChange: string,\n  nrr: string,\n  nrrChange: string,\n  churn: string,\n  churnChange: string,\n): Metric[] {\n  return [\n    {\n      id: \"mrr\",\n      label: \"Monthly recurring revenue\",\n      value: \"$84,240\",\n      change: mrrChange,\n      sentiment: \"positive\",\n    },\n    {\n      id: \"customers\",\n      label: \"Active customers\",\n      value: \"1,842\",\n      change: customersChange,\n      sentiment: \"positive\",\n    },\n    {\n      id: \"nrr\",\n      label: \"Net revenue retention\",\n      value: nrr,\n      change: nrrChange,\n      sentiment: \"positive\",\n    },\n    // Churn falling is good news — sentiment is not the sign of the number.\n    {\n      id: \"churn\",\n      label: \"Churn\",\n      value: churn,\n      change: churnChange,\n      sentiment: \"positive\",\n    },\n  ];\n}\n\nexport const metricsByRange: Record<DateRangeKey, Metric[]> = {\n  \"7d\": buildMetrics(\"+1.8%\", \"+0.9%\", \"107.2%\", \"+0.4%\", \"0.6%\", \"-0.1%\"),\n  \"30d\": buildMetrics(\"+12.4%\", \"+8.2%\", \"108.6%\", \"+2.1%\", \"2.4%\", \"-0.6%\"),\n  \"90d\": buildMetrics(\"+28.6%\", \"+19.4%\", \"109.4%\", \"+3.2%\", \"6.9%\", \"-1.1%\"),\n  ytd: buildMetrics(\"+64.2%\", \"+47.8%\", \"110.2%\", \"+4.7%\", \"15.8%\", \"-2.9%\"),\n};\n\n/* ------------------------------------------------------------------ */\n/* Revenue series                                                      */\n/* ------------------------------------------------------------------ */\n\ninterface RangeShape {\n  points: number;\n  /** Distance in days between points. */\n  stepDays: number;\n}\n\nconst rangeShapes: Record<DateRangeKey, RangeShape> = {\n  \"7d\": { points: 7, stepDays: 1 },\n  \"30d\": { points: 30, stepDays: 1 },\n  \"90d\": { points: 13, stepDays: 7 },\n  ytd: { points: 8, stepDays: 30 },\n};\n\nfunction seriesDates(\n  shape: RangeShape,\n): Array<{ date: string; label: string }> {\n  const monthly = shape.stepDays >= 28;\n  const dates: Array<{ date: string; label: string }> = [];\n  for (let i = shape.points - 1; i >= 0; i--) {\n    const day = daysAgo(i * shape.stepDays);\n    dates.push({\n      date: isoDate(day),\n      label: day.toLocaleDateString(\"en-US\", {\n        month: \"short\",\n        ...(monthly ? {} : { day: \"numeric\" }),\n      }),\n    });\n  }\n  return dates;\n}\n\n/**\n * Generates a series that trends from `start` to `end` with seeded noise, so\n * the line rises overall but keeps a few believable dips.\n */\nfunction trendSeries(\n  seed: number,\n  points: number,\n  start: number,\n  end: number,\n  noise: number,\n): number[] {\n  const random = seededRandom(seed);\n  const values: number[] = [];\n  for (let i = 0; i < points; i++) {\n    const progress = points === 1 ? 1 : i / (points - 1);\n    const wobble = (random() - 0.42) * noise;\n    const value = start + (end - start) * progress + wobble;\n    values.push(Math.round(Math.max(0, value)));\n  }\n  return values;\n}\n\nfunction buildRevenueSeries(\n  seed: number,\n  shape: RangeShape,\n  current: { start: number; end: number },\n  previousScale: number,\n  noise: number,\n): RevenuePoint[] {\n  const dates = seriesDates(shape);\n  const currentValues = trendSeries(\n    seed,\n    shape.points,\n    current.start,\n    current.end,\n    noise,\n  );\n  const previousValues = trendSeries(\n    seed + 1,\n    shape.points,\n    current.start * previousScale,\n    current.end * previousScale,\n    noise,\n  );\n  return dates.map(({ date, label }, i) => ({\n    date,\n    label,\n    current: currentValues[i],\n    previous: previousValues[i],\n  }));\n}\n\n/** Per-day flow rates (new, expansion, churned MRR) used to scale ranges. */\nconst flowRates: Record<\n  Exclude<RevenueMetricKey, \"revenue\">,\n  { start: number; end: number; noise: number }\n> = {\n  \"new-mrr\": { start: 380, end: 640, noise: 260 },\n  expansion: { start: 150, end: 320, noise: 150 },\n  churned: { start: 210, end: 140, noise: 110 },\n};\n\nfunction buildRangeSeries(\n  rangeKey: DateRangeKey,\n  seed: number,\n): Record<RevenueMetricKey, RevenuePoint[]> {\n  const shape = rangeShapes[rangeKey];\n  // MRR endpoints per range: always ends at ~$84.2k, starts further back the\n  // longer the window is.\n  const mrrStart: Record<DateRangeKey, number> = {\n    \"7d\": 82760,\n    \"30d\": 74950,\n    \"90d\": 65510,\n    ytd: 51300,\n  };\n\n  const series = {\n    revenue: buildRevenueSeries(\n      seed,\n      shape,\n      { start: mrrStart[rangeKey], end: 84240 },\n      0.87,\n      rangeKey === \"7d\" ? 350 : 1400,\n    ),\n  } as Record<RevenueMetricKey, RevenuePoint[]>;\n\n  for (const key of [\"new-mrr\", \"expansion\", \"churned\"] as const) {\n    const rate = flowRates[key];\n    series[key] = buildRevenueSeries(\n      seed + revenueMetricOptions.findIndex((o) => o.key === key) * 7,\n      shape,\n      {\n        start: rate.start * shape.stepDays,\n        end: rate.end * shape.stepDays,\n      },\n      key === \"churned\" ? 1.18 : 0.85,\n      rate.noise * shape.stepDays,\n    );\n  }\n\n  return series;\n}\n\nconst revenueSeries: Record<\n  DateRangeKey,\n  Record<RevenueMetricKey, RevenuePoint[]>\n> = {\n  \"7d\": buildRangeSeries(\"7d\", 11),\n  \"30d\": buildRangeSeries(\"30d\", 23),\n  \"90d\": buildRangeSeries(\"90d\", 37),\n  ytd: buildRangeSeries(\"ytd\", 53),\n};\n\nexport function getRevenueSeries(\n  range: DateRangeKey,\n  metric: RevenueMetricKey,\n): RevenuePoint[] {\n  return revenueSeries[range][metric];\n}\n\n/* ------------------------------------------------------------------ */\n/* Acquisition                                                         */\n/* ------------------------------------------------------------------ */\n\nconst acquisitionBase: AcquisitionChannel[] = [\n  { channel: \"Organic search\", sessions: 9840, conversionRate: 3.1, customers: 148 },\n  { channel: \"Direct\", sessions: 6420, conversionRate: 2.4, customers: 87 },\n  { channel: \"Referral\", sessions: 3980, conversionRate: 4.2, customers: 96 },\n  { channel: \"Social\", sessions: 2860, conversionRate: 1.1, customers: 22 },\n  { channel: \"Paid search\", sessions: 1720, conversionRate: 3.8, customers: 41 },\n];\n\nfunction scaleAcquisition(\n  factor: number,\n  conversionShift: number,\n  seed: number,\n): AcquisitionChannel[] {\n  const random = seededRandom(seed);\n  return acquisitionBase.map((channel) => {\n    const jitter = 0.9 + random() * 0.2;\n    const sessions = Math.round((channel.sessions * factor * jitter) / 10) * 10;\n    const conversionRate =\n      Math.round((channel.conversionRate + conversionShift) * 10) / 10;\n    return {\n      channel: channel.channel,\n      sessions,\n      conversionRate,\n      customers: Math.round(sessions * (conversionRate / 100)),\n    };\n  });\n}\n\nexport const acquisitionByRange: Record<DateRangeKey, AcquisitionChannel[]> = {\n  \"7d\": scaleAcquisition(0.24, -0.2, 71),\n  \"30d\": acquisitionBase,\n  \"90d\": scaleAcquisition(2.9, -0.3, 73),\n  ytd: scaleAcquisition(7.6, -0.5, 79),\n};\n\n/* ------------------------------------------------------------------ */\n/* Conversion funnel                                                   */\n/* ------------------------------------------------------------------ */\n\nexport const funnelStages: FunnelStage[] = [\n  { stage: \"Visitors\", value: 24820 },\n  { stage: \"Signed up\", value: 4930 },\n  { stage: \"Activated\", value: 3160 },\n  { stage: \"Started trial\", value: 1420 },\n  { stage: \"Converted\", value: 682 },\n];\n\n/* ------------------------------------------------------------------ */\n/* Retention cohorts                                                   */\n/* ------------------------------------------------------------------ */\n\n/** Baseline weekly retention curve, percent of cohort still active. */\nconst retentionCurve = [100, 78, 69, 64, 61, 59, 57.5, 56.5, 56];\n\nexport const retentionWeeks = retentionCurve.map((_, i) => `W${i}`);\n\nfunction buildRetentionCohorts(): RetentionCell[] {\n  const cells: RetentionCell[] = [];\n  const cohortCount = 8;\n  const random = seededRandom(97);\n\n  for (let c = 0; c < cohortCount; c++) {\n    const cohortStart = daysAgo((cohortCount - c + 1) * 7);\n    const cohort = cohortStart.toLocaleDateString(\"en-US\", {\n      month: \"short\",\n      day: \"numeric\",\n    });\n    // Newer cohorts retain slightly better — and have fewer observed weeks.\n    const cohortLift = c * 0.9;\n    const observedWeeks = Math.min(retentionCurve.length, cohortCount + 1 - c);\n\n    for (let w = 0; w < observedWeeks; w++) {\n      const jitter = (random() - 0.5) * 3.4;\n      const retention =\n        w === 0 ? 100 : Math.min(99, retentionCurve[w] + cohortLift + jitter);\n      cells.push({\n        cohort,\n        week: retentionWeeks[w],\n        retention: Math.round(retention * 10) / 10,\n      });\n    }\n  }\n\n  return cells;\n}\n\nexport const retentionCohorts: RetentionCell[] = buildRetentionCohorts();\n\n/* ------------------------------------------------------------------ */\n/* Customers                                                           */\n/* ------------------------------------------------------------------ */\n\nexport const customers: Customer[] = [\n  { id: \"linear-labs\", name: \"Linear Labs\", plan: \"Enterprise\", mrr: 8900, seats: 164, health: \"Healthy\", lastActive: \"12m ago\" },\n  { id: \"atlas-systems\", name: \"Atlas Systems\", plan: \"Business\", mrr: 3420, seats: 58, health: \"Healthy\", lastActive: \"1h ago\" },\n  { id: \"mercury-works\", name: \"Mercury Works\", plan: \"Business\", mrr: 2760, seats: 44, health: \"Watch\", lastActive: \"2d ago\" },\n  { id: \"northwind\", name: \"Northwind\", plan: \"Business\", mrr: 2510, seats: 39, health: \"Healthy\", lastActive: \"36m ago\" },\n  { id: \"acme-studio\", name: \"Acme Studio\", plan: \"Pro\", mrr: 890, seats: 18, health: \"Healthy\", lastActive: \"3h ago\" },\n  { id: \"vanta-labs\", name: \"Vanta Labs\", plan: \"Enterprise\", mrr: 6240, seats: 112, health: \"Watch\", lastActive: \"5d ago\" },\n  { id: \"relay\", name: \"Relay\", plan: \"Pro\", mrr: 740, seats: 15, health: \"Healthy\", lastActive: \"22m ago\" },\n  { id: \"summit\", name: \"Summit\", plan: \"Starter\", mrr: 240, seats: 6, health: \"At risk\", lastActive: \"3w ago\" },\n  { id: \"fieldstone\", name: \"Fieldstone\", plan: \"Pro\", mrr: 620, seats: 12, health: \"Healthy\", lastActive: \"1h ago\" },\n  { id: \"cobalt-systems\", name: \"Cobalt Systems\", plan: \"Business\", mrr: 1980, seats: 31, health: \"Healthy\", lastActive: \"4h ago\" },\n  { id: \"juniper-health\", name: \"Juniper Health\", plan: \"Enterprise\", mrr: 5480, seats: 96, health: \"Healthy\", lastActive: \"55m ago\" },\n  { id: \"beacon-analytics\", name: \"Beacon Analytics\", plan: \"Pro\", mrr: 810, seats: 16, health: \"Watch\", lastActive: \"6d ago\" },\n  { id: \"driftwood\", name: \"Driftwood\", plan: \"Starter\", mrr: 180, seats: 4, health: \"Healthy\", lastActive: \"2h ago\" },\n  { id: \"halcyon-media\", name: \"Halcyon Media\", plan: \"Pro\", mrr: 560, seats: 11, health: \"At risk\", lastActive: \"2w ago\" },\n  { id: \"orbital\", name: \"Orbital\", plan: \"Business\", mrr: 2140, seats: 35, health: \"Healthy\", lastActive: \"18m ago\" },\n  { id: \"pinewheel\", name: \"Pinewheel\", plan: \"Starter\", mrr: 290, seats: 7, health: \"Healthy\", lastActive: \"1d ago\" },\n  { id: \"quartz-digital\", name: \"Quartz Digital\", plan: \"Pro\", mrr: 980, seats: 21, health: \"Healthy\", lastActive: \"40m ago\" },\n  { id: \"riverbed-labs\", name: \"Riverbed Labs\", plan: \"Business\", mrr: 1650, seats: 27, health: \"Watch\", lastActive: \"3d ago\" },\n  { id: \"solstice\", name: \"Solstice\", plan: \"Starter\", mrr: 120, seats: 3, health: \"Watch\", lastActive: \"1w ago\" },\n  { id: \"tandem-hq\", name: \"Tandem HQ\", plan: \"Pro\", mrr: 720, seats: 14, health: \"Healthy\", lastActive: \"5h ago\" },\n  { id: \"umbra-security\", name: \"Umbra Security\", plan: \"Enterprise\", mrr: 4120, seats: 73, health: \"Healthy\", lastActive: \"1h ago\" },\n  { id: \"waypoint\", name: \"Waypoint\", plan: \"Starter\", mrr: 210, seats: 5, health: \"At risk\", lastActive: \"4w ago\" },\n];\n\nexport const planNames = [\"Starter\", \"Pro\", \"Business\", \"Enterprise\"] as const;\nexport const healthStatuses = [\"Healthy\", \"Watch\", \"At risk\"] as const;\n\n/* ------------------------------------------------------------------ */\n/* Activity + insight                                                  */\n/* ------------------------------------------------------------------ */\n\nexport const recentActivity: ActivityEvent[] = [\n  { id: \"a1\", kind: \"upgrade\", event: \"Upgraded to Business\", customer: \"Northwind\", time: \"2h ago\" },\n  { id: \"a2\", kind: \"expansion\", event: \"Added 14 seats\", customer: \"Atlas Systems\", time: \"5h ago\" },\n  { id: \"a3\", kind: \"renewal\", event: \"Renewed annual plan\", customer: \"Relay\", time: \"Yesterday\" },\n  { id: \"a4\", kind: \"contraction\", event: \"Cancelled 2 seats\", customer: \"Mercury Works\", time: \"Yesterday\" },\n  { id: \"a5\", kind: \"trial\", event: \"Started a Pro trial\", customer: \"Acme Studio\", time: \"2d ago\" },\n  { id: \"a6\", kind: \"expansion\", event: \"Added 6 seats\", customer: \"Juniper Health\", time: \"3d ago\" },\n];\n\nexport const quickInsight: Insight = {\n  headline: \"Expansion revenue is up 18%\",\n  detail:\n    \"Business plan upgrades generated $4,280 in expansion MRR this month, the best upgrade month this year.\",\n  breakdown: [\n    { label: \"Business\", mrr: 4280 },\n    { label: \"Enterprise\", mrr: 1360 },\n    { label: \"Pro\", mrr: 940 },\n    { label: \"Starter\", mrr: 210 },\n  ],\n};\n"},{"path":"registry/default/blocks/analytics-dashboard/lib/dashboard/format.ts","type":"registry:lib","target":"lib/dashboard/format.ts","content":"const currency = new Intl.NumberFormat(\"en-US\", {\n  style: \"currency\",\n  currency: \"USD\",\n  maximumFractionDigits: 0,\n});\n\nconst compactCurrency = new Intl.NumberFormat(\"en-US\", {\n  style: \"currency\",\n  currency: \"USD\",\n  notation: \"compact\",\n  maximumFractionDigits: 1,\n});\n\nconst number = new Intl.NumberFormat(\"en-US\");\n\nconst compactNumber = new Intl.NumberFormat(\"en-US\", {\n  notation: \"compact\",\n  maximumFractionDigits: 1,\n});\n\n/** \"$84,240\" */\nexport function formatCurrency(value: number): string {\n  return currency.format(value);\n}\n\n/** \"$84.2K\" — for chart axes and tight spots. */\nexport function formatCompactCurrency(value: number): string {\n  return compactCurrency.format(value);\n}\n\n/** \"24,820\" */\nexport function formatNumber(value: number): string {\n  return number.format(value);\n}\n\n/** \"24.8K\" */\nexport function formatCompactNumber(value: number): string {\n  return compactNumber.format(value);\n}\n\n/** \"2.4%\" */\nexport function formatPercent(value: number, fractionDigits = 1): string {\n  return `${value.toFixed(fractionDigits)}%`;\n}\n\n/** \"Aug 14\" from an ISO date string. */\nexport function formatShortDate(isoDate: string): string {\n  const date = new Date(`${isoDate}T00:00:00`);\n  return date.toLocaleDateString(\"en-US\", { month: \"short\", day: \"numeric\" });\n}\n"},{"path":"registry/default/blocks/analytics-dashboard/lib/dashboard/types.ts","type":"registry:lib","target":"lib/dashboard/types.ts","content":"export type DateRangeKey = \"7d\" | \"30d\" | \"90d\" | \"ytd\";\n\nexport interface DateRangeOption {\n  key: DateRangeKey;\n  label: string;\n  /** Label used in \"vs.\" comparison copy, e.g. \"previous 30 days\". */\n  comparisonLabel: string;\n}\n\nexport type RevenueMetricKey = \"revenue\" | \"new-mrr\" | \"expansion\" | \"churned\";\n\nexport interface RevenueMetricOption {\n  key: RevenueMetricKey;\n  label: string;\n}\n\n/** Type alias (not interface) so it satisfies the chart data constraint. */\nexport type RevenuePoint = {\n  /** ISO date (day the point represents, or period start for aggregates). */\n  date: string;\n  /** Display label used on the axis and in tooltips, e.g. \"Aug 19\". */\n  label: string;\n  current: number;\n  previous: number;\n};\n\nexport type MetricSentiment = \"positive\" | \"negative\";\n\nexport interface Metric {\n  id: string;\n  label: string;\n  value: string;\n  /** Signed change vs. the previous period, e.g. \"+12.4%\". */\n  change: string;\n  /** Whether the change is good news — a falling churn rate is positive. */\n  sentiment: MetricSentiment;\n}\n\n/** Type alias (not interface) so it satisfies the chart data constraint. */\nexport type AcquisitionChannel = {\n  channel: string;\n  sessions: number;\n  /** Visitor → customer conversion rate, in percent. */\n  conversionRate: number;\n  customers: number;\n};\n\nexport interface FunnelStage {\n  stage: string;\n  value: number;\n}\n\n/** Type alias (not interface) so it satisfies the chart data constraint. */\nexport type RetentionCell = {\n  /** Cohort label, e.g. \"Jul 6\". */\n  cohort: string;\n  /** Week offset label, e.g. \"W3\". */\n  week: string;\n  /** Percentage of the cohort still active, 0–100. */\n  retention: number;\n};\n\nexport type PlanName = \"Starter\" | \"Pro\" | \"Business\" | \"Enterprise\";\n\nexport type HealthStatus = \"Healthy\" | \"Watch\" | \"At risk\";\n\nexport interface Customer {\n  id: string;\n  name: string;\n  plan: PlanName;\n  mrr: number;\n  seats: number;\n  health: HealthStatus;\n  lastActive: string;\n}\n\nexport type ActivityKind =\n  | \"upgrade\"\n  | \"expansion\"\n  | \"renewal\"\n  | \"contraction\"\n  | \"trial\";\n\nexport interface ActivityEvent {\n  id: string;\n  kind: ActivityKind;\n  event: string;\n  customer: string;\n  time: string;\n}\n\nexport interface Insight {\n  headline: string;\n  detail: string;\n  /** Expansion MRR this month by plan, largest first. */\n  breakdown: Array<{ label: string; mrr: number }>;\n}\n"}]}