{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"event-calendar-content","type":"registry:ui","title":"Active-view switchboard rendering month, week, day, N-days, or agenda; swappable per view via the components prop.","description":"Active-view switchboard rendering month, week, day, N-days, or agenda; swappable per view via the components prop.","dependencies":["@base-ui/react","cn"],"registryDependencies":["@reui/event-calendar","@reui/event-calendar-agenda-view","@reui/event-calendar-month-view","@reui/event-calendar-resource-view","@reui/event-calendar-time-grid","@reui/event-calendar-types"],"files":[{"path":"event-calendar-content.tsx","type":"registry:ui","content":"// Title: Event Calendar Content\n// Description: Active-view switchboard rendering month, week, day, N-days, or agenda; swappable per view via the components prop.\n\n\"use client\"\n\nimport { type ComponentType, type ReactNode } from \"react\"\nimport {\n  useEventCalendarSelector,\n  useEventCalendarViewConfig,\n} from \"@/components/reui/event-calendar/event-calendar\"\nimport { EventCalendarAgendaView } from \"@/components/reui/event-calendar/event-calendar-agenda-view\"\nimport { EventCalendarMonthView } from \"@/components/reui/event-calendar/event-calendar-month-view\"\nimport { EventCalendarResourceView } from \"@/components/reui/event-calendar/event-calendar-resource-view\"\nimport {\n  EventCalendarDaysView,\n  EventCalendarDayView,\n  EventCalendarWeekView,\n} from \"@/components/reui/event-calendar/event-calendar-time-grid\"\nimport type { CalendarView } from \"@/components/reui/event-calendar/event-calendar-types\"\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\n\nimport { cn } from \"cn\"\n\nconst DEFAULT_VIEW_COMPONENTS: Record<CalendarView, ComponentType> = {\n  month: EventCalendarMonthView,\n  week: EventCalendarWeekView,\n  day: EventCalendarDayView,\n  days: EventCalendarDaysView,\n  agenda: EventCalendarAgendaView,\n  resource: EventCalendarResourceView,\n}\n\ninterface EventCalendarContentProps extends Omit<\n  useRender.ComponentProps<\"div\">,\n  \"children\"\n> {\n  /** Swap individual view implementations. */\n  components?: Partial<Record<CalendarView, ComponentType>>\n  /** Replaces the switchboard entirely; read useEventCalendarView() inside. */\n  children?: ReactNode\n}\n\nfunction EventCalendarContent({\n  className,\n  render,\n  components,\n  children,\n  ...props\n}: EventCalendarContentProps) {\n  const viewConfig = useEventCalendarViewConfig()\n  const view = useEventCalendarSelector((state) => state.view)\n  const loading = useEventCalendarSelector((state) => state.loading)\n\n  const resolved = {\n    ...DEFAULT_VIEW_COMPONENTS,\n    ...viewConfig.components,\n    ...components,\n  }\n  // A spread copies keys that hold `undefined`, so `components={{ month: isPro\n  // ? ProMonth : undefined }}` would erase the default and render <undefined />.\n  const ActiveView = resolved[view] ?? DEFAULT_VIEW_COMPONENTS[view]\n\n  const defaultProps = {\n    \"data-slot\": \"event-calendar-content\",\n    \"data-view\": view,\n    \"data-loading\": loading || undefined,\n    className: cn(\n      \"relative flex min-h-0 min-w-0 flex-1 flex-col\",\n      \"data-loading:pointer-events-none data-loading:opacity-60\",\n      viewConfig.classNames?.content,\n      className\n    ),\n    children: children ?? <ActiveView />,\n  }\n\n  return useRender({\n    defaultTagName: \"div\",\n    render,\n    props: mergeProps<\"div\">(defaultProps, props),\n  })\n}\n\nexport { DEFAULT_VIEW_COMPONENTS, EventCalendarContent }\nexport type { EventCalendarContentProps }","target":"components/reui/event-calendar/event-calendar-content.tsx"}]}