{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "calendar-sidebar",
  "title": "Calendar Sidebar",
  "description": "The left sidebar: mini calendar, scheduling, calendar list and theme toggle, inline or as an overlay.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "@calendarcn/calendar-core",
    "@calendarcn/mini-calendar",
    "@calendarcn/calendar-list",
    "@calendarcn/sidebar-overlay",
    "@calendarcn/theme-toggle",
    "button",
    "kbd",
    "sidebar",
    "tooltip"
  ],
  "files": [
    {
      "path": "src/components/calendar-sidebar.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { Link2, PanelLeftIcon, Plus, UserRound } from \"lucide-react\";\n\nimport { cn } from \"@/lib/utils\";\nimport { useCalendar } from \"@/components/calendar-provider\";\nimport { CalendarList } from \"@/components/calendar-list\";\nimport { MiniCalendar } from \"@/components/mini-calendar\";\nimport {\n  CALENDAR_SIDEBAR_COLORS_CLASS,\n  SidebarOverlay,\n} from \"@/components/sidebar-overlay\";\nimport { ThemeToggle } from \"@/components/theme-toggle\";\nimport { Button } from \"@/components/ui/button\";\nimport { Kbd } from \"@/components/ui/kbd\";\nimport {\n  SidebarContent,\n  SidebarFooter,\n  SidebarGroup,\n  SidebarGroupContent,\n  SidebarMenu,\n  SidebarMenuButton,\n  SidebarMenuItem,\n  SidebarSeparator,\n} from \"@/components/ui/sidebar\";\nimport {\n  Tooltip,\n  TooltipContent,\n  TooltipTrigger,\n} from \"@/components/ui/tooltip\";\nimport { getPeriodStart } from \"@/lib/event-utils\";\n\n/** Width of the calendar sidebar, inline and as an overlay */\nexport const CALENDAR_SIDEBAR_WIDTH = \"15rem\";\n\n/** No days to highlight: month view and the agenda */\nconst NO_VISIBLE_DAYS: Date[] = [];\n\n/** \"Soon\" badge of a sidebar control that isn't built yet, as in the command menu */\nconst CALENDAR_SIDEBAR_SOON_CLASS =\n  \"bg-sidebar-foreground/10 text-sidebar-foreground/60 ml-auto shrink-0 rounded px-1 py-0.5 text-[10px] leading-none font-medium\";\n\ninterface CalendarSidebarProps {\n  /** Whether the sidebar shows. Defaults to true */\n  open?: boolean;\n  /** Called when the overlay asks to close (outside tap, Escape, close button, a day picked) */\n  onOpenChange?: (open: boolean) => void;\n  /** Render as a modal sheet instead of an inline column (phones) */\n  overlay?: boolean;\n  /** Buttons shown in the footer before the theme toggle, e.g. links */\n  footerActions?: React.ReactNode;\n  /** Ids of the hidden calendars (controlled), see `CalendarList` */\n  hiddenCalendarIds?: string[];\n  /** Ids of the calendars hidden at first (uncontrolled) */\n  defaultHiddenCalendarIds?: string[];\n  /** Called with the new hidden ids when a calendar is shown or hidden */\n  onHiddenCalendarIdsChange?: (hiddenCalendarIds: string[]) => void;\n  /** Classes for the inline sidebar's fixed column */\n  className?: string;\n}\n\n/**\n * Notion Calendar's left sidebar: the mini calendar, scheduling, the\n * calendar list and a theme toggle. Inline it's a fixed column that pushes\n * the page over; with `overlay` it's a sheet from the left. Reads the\n * calendar's date and view from the nearest `CalendarProvider`, and needs\n * shadcn/ui's `SidebarProvider` around it. The scheduling row, the \"Meet\n * with...\" field and \"Add calendar account\" aren't built: they are disabled\n * and marked \"Soon\".\n */\nexport function CalendarSidebar({\n  open = true,\n  onOpenChange,\n  overlay = false,\n  footerActions,\n  hiddenCalendarIds,\n  defaultHiddenCalendarIds,\n  onHiddenCalendarIdsChange,\n  className,\n}: CalendarSidebarProps) {\n  const {\n    view,\n    currentDate,\n    displayMonth,\n    visibleDays,\n    weekStartsOn,\n    numberOfDays,\n    goToDate,\n  } = useCalendar();\n\n  const sidebarStyle = {\n    \"--sidebar-width\": CALENDAR_SIDEBAR_WIDTH,\n  } as React.CSSProperties;\n\n  /** Mini calendar day pick: go to its period, and get the overlay out of the way */\n  const handleDateSelect = (date: Date) => {\n    goToDate(getPeriodStart(date, view, weekStartsOn, numberOfDays));\n    if (overlay) onOpenChange?.(false);\n  };\n\n  const content = (\n    <>\n      {/* Spacing set here, not left to the shadcn/ui style (nova has none) */}\n      <SidebarContent className=\"gap-2\">\n        <SidebarGroup className=\"px-0\">\n          <SidebarGroupContent>\n            <MiniCalendar\n              onDateSelect={handleDateSelect}\n              currentDate={\n                view === \"month\" && displayMonth ? displayMonth : currentDate\n              }\n              visibleDays={\n                view === \"month\" || view === \"agenda\"\n                  ? NO_VISIBLE_DAYS\n                  : visibleDays\n              }\n              weekStartsOn={weekStartsOn}\n            />\n          </SidebarGroupContent>\n        </SidebarGroup>\n        {/* Scheduling Section */}\n        <SidebarGroup className=\"py-0\">\n          <SidebarGroupContent>\n            <SidebarMenu className=\"gap-1\">\n              <SidebarMenuItem>\n                {/* Not built yet */}\n                <SidebarMenuButton\n                  disabled\n                  className=\"text-sidebar-foreground rounded-sm disabled:opacity-100\"\n                >\n                  <Link2 className=\"size-4 text-calendar-sidebar-muted-foreground\" />\n                  <span className=\"min-w-0 flex-1 truncate text-sm opacity-50\">\n                    Scheduling\n                  </span>\n                  <span className={CALENDAR_SIDEBAR_SOON_CLASS}>Soon</span>\n                </SidebarMenuButton>\n              </SidebarMenuItem>\n            </SidebarMenu>\n          </SidebarGroupContent>\n        </SidebarGroup>\n        {/* Meet with input: not built yet */}\n        <SidebarGroup className=\"py-2 px-2\">\n          <div className=\"flex items-center gap-2 rounded-sm bg-[#EFEFEE] dark:bg-sidebar px-2 py-1.5\">\n            <UserRound className=\"size-4 shrink-0 text-calendar-sidebar-muted-foreground\" />\n            <input\n              type=\"text\"\n              disabled\n              placeholder=\"Meet with...\"\n              className=\"min-w-0 flex-1 bg-transparent text-sm text-sidebar-foreground placeholder:text-calendar-sidebar-muted-foreground outline-none\"\n            />\n            <span className={CALENDAR_SIDEBAR_SOON_CLASS}>Soon</span>\n          </div>\n        </SidebarGroup>\n        <CalendarList\n          hiddenCalendarIds={hiddenCalendarIds}\n          defaultHiddenCalendarIds={defaultHiddenCalendarIds}\n          onHiddenCalendarIdsChange={onHiddenCalendarIdsChange}\n        />\n        <SidebarSeparator className=\"mx-0\" />\n        <SidebarGroup className=\"py-0\">\n          <SidebarGroupContent>\n            <SidebarMenu className=\"gap-1\">\n              <SidebarMenuItem>\n                {/* Not built yet */}\n                <SidebarMenuButton\n                  disabled\n                  className=\"text-sidebar-foreground gap-1.5 text-sm rounded-sm disabled:opacity-100\"\n                >\n                  <Plus className=\"size-4 opacity-50\" />\n                  <span className=\"min-w-0 flex-1 truncate opacity-50\">\n                    Add calendar account\n                  </span>\n                  <span className={CALENDAR_SIDEBAR_SOON_CLASS}>Soon</span>\n                </SidebarMenuButton>\n              </SidebarMenuItem>\n            </SidebarMenu>\n          </SidebarGroupContent>\n        </SidebarGroup>\n      </SidebarContent>\n      <SidebarFooter className=\"border-t border-sidebar-border\">\n        <div className=\"flex items-center justify-start gap-1 px-2 py-2\">\n          {footerActions}\n          <Tooltip>\n            <TooltipTrigger asChild>\n              <ThemeToggle className=\"text-sidebar-foreground\" />\n            </TooltipTrigger>\n            <TooltipContent side=\"top\">\n              Toggle theme <Kbd className=\"ml-1\">shift</Kbd> <Kbd>M</Kbd>\n            </TooltipContent>\n          </Tooltip>\n        </div>\n      </SidebarFooter>\n    </>\n  );\n\n  if (overlay) {\n    return (\n      <SidebarOverlay\n        open={open}\n        onOpenChange={(next) => onOpenChange?.(next)}\n        side=\"left\"\n        title=\"Calendar sidebar\"\n        description=\"Mini calendar, scheduling and calendar list.\"\n        style={sidebarStyle}\n      >\n        {/* Same height and position as the header toggle, so tapping the same spot closes it */}\n        <div className=\"flex h-14 shrink-0 items-center pl-2\">\n          <Button\n            variant=\"ghost\"\n            size=\"icon\"\n            className=\"size-7 text-muted-foreground\"\n            onClick={() => onOpenChange?.(false)}\n          >\n            <PanelLeftIcon />\n            <span className=\"sr-only\">Close calendar sidebar</span>\n          </Button>\n        </div>\n        {content}\n      </SidebarOverlay>\n    );\n  }\n\n  return (\n    <div\n      data-state={open ? \"expanded\" : \"collapsed\"}\n      className={cn(\n        CALENDAR_SIDEBAR_COLORS_CLASS,\n        \"text-sidebar-foreground group peer hidden md:block\",\n      )}\n      style={sidebarStyle}\n    >\n      {/* Gap element that handles the space transition */}\n      <div\n        className={cn(\n          \"relative bg-transparent\",\n          open ? \"w-(--sidebar-width)\" : \"w-0\",\n        )}\n      />\n      {/* Sidebar container */}\n      <div\n        className={cn(\n          \"bg-sidebar fixed inset-y-0 left-0 z-10 hidden h-svh w-(--sidebar-width) flex-col border-r md:flex\",\n          open ? \"left-0\" : \"left-[calc(var(--sidebar-width)*-1)]\",\n          className,\n        )}\n      >\n        {content}\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}