"use client"; import { cn } from "@/lib/utils"; import { StatusBarContext, type StatusBarProps, useStatusBarModel } from "./status-bar/context"; import { StatusBarLegend } from "./status-bar/legend"; import { StatusBarPlot } from "./status-bar/plot"; import { StatusBarTooltip } from "./status-bar/tooltip"; /** Compose Plot, Tooltip, and Legend, or omit children for the complete chart. */ export function StatusBar({ data, statuses, label, activeId, defaultActiveId, onActiveChange, labels, children, className, ...props }: StatusBarProps) { const model = useStatusBarModel({ data, statuses, label, activeId, defaultActiveId, onActiveChange, labels, }); const { t } = model; return (
{children === undefined ? ( <> ) : ( children )} {/* Color is never the only way to read the history. The complete data stays available to screen readers without dozens of tab stops. */}
{model.rows.map(({ datum, status }) => ( ))}
{t("tableCaption", { label: model.label })}
{t("period")} {t("status")} {t("details")}
{datum.label} {status.label} {datum.description ?? ""}
); } export type { StatusBarDatum, StatusBarProps, StatusBarStatus } from "./status-bar/context"; export { STATUS_BAR_STATUSES, useStatusBar } from "./status-bar/context"; export type { StatusBarLegendProps } from "./status-bar/legend"; export { StatusBarLegend } from "./status-bar/legend"; export { type StatusBarMessages, statusBarMessages } from "./status-bar/messages"; export type { StatusBarPlotProps } from "./status-bar/plot"; export { StatusBarPlot } from "./status-bar/plot"; export type { StatusBarTooltipData, StatusBarTooltipProps } from "./status-bar/tooltip"; export { StatusBarTooltip } from "./status-bar/tooltip";