{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "service-status",
  "type": "registry:block",
  "title": "Service status",
  "description": "Service health, availability history, and a slot for period controls or incident notes.",
  "categories": [
    "blocks"
  ],
  "dependencies": [],
  "registryDependencies": [
    "card"
  ],
  "files": [
    {
      "path": "src/registry/overtrue/service-status.tsx",
      "type": "registry:component",
      "target": "components/overtrue/service-status.tsx",
      "content": "import type { ReactNode } from \"react\";\nimport {\n  Card,\n  CardContent,\n  CardHeader,\n  CardTitle,\n  CardDescription,\n} from \"@/components/ui/card\";\nimport { StatusBadge } from \"./status-badge\";\nimport {\n  UptimeHistory,\n  type AvailabilityStatus,\n  type UptimeSample,\n} from \"./uptime-history\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface ServiceRecord {\n  id: string;\n  name: string;\n  status: AvailabilityStatus;\n  samples: readonly UptimeSample[];\n  startLabel?: string;\n  endLabel?: string;\n}\nconst states = {\n  operational: { label: \"Operational\", variant: \"success\" },\n  degraded: { label: \"Degraded\", variant: \"warning\" },\n  outage: { label: \"Outage\", variant: \"error\" },\n  unknown: { label: \"Unknown\", variant: \"neutral\" },\n} as const;\n\n/** Parent owns the selected period, data loading and incident content. */\nexport function ServiceStatus({\n  services,\n  title = \"Service availability\",\n  description,\n  actions,\n  children,\n  className,\n}: {\n  services: readonly ServiceRecord[];\n  title?: string;\n  description?: string;\n  actions?: ReactNode;\n  children?: ReactNode;\n  className?: string;\n}) {\n  return (\n    <Card\n      data-slot=\"service-status\"\n      className={cn(\n        \"min-w-0 gap-0 rounded-lg border bg-card py-0 text-card-foreground shadow-none\",\n        className,\n      )}\n    >\n      <CardHeader className=\"flex flex-wrap items-start justify-between gap-4 border-0 p-5 pb-0\">\n        <div className=\"grid gap-1\">\n          <CardTitle className=\"m-0 text-sm font-semibold\">{title}</CardTitle>\n          {description && (\n            <CardDescription className=\"m-0 text-xs text-muted-foreground\">\n              {description}\n            </CardDescription>\n          )}\n        </div>\n        {actions}\n      </CardHeader>\n      <CardContent className=\"space-y-6 p-5\">\n        {services.length ? (\n          services.map((service) => (\n            <section\n              key={service.id}\n              aria-label={service.name}\n              className=\"space-y-3\"\n            >\n              <div className=\"flex flex-wrap items-center justify-between gap-2\">\n                <h3 className=\"m-0 text-sm font-medium\">{service.name}</h3>\n                <StatusBadge variant={states[service.status].variant}>\n                  {states[service.status].label}\n                </StatusBadge>\n              </div>\n              <UptimeHistory\n                label={`${service.name} availability history`}\n                samples={service.samples}\n                startLabel={service.startLabel}\n                endLabel={service.endLabel}\n              />\n            </section>\n          ))\n        ) : (\n          <p className=\"text-sm text-muted-foreground\">\n            No services to report yet.\n          </p>\n        )}\n        {children}\n      </CardContent>\n    </Card>\n  );\n}\n"
    },
    {
      "path": "src/registry/overtrue/status-badge.tsx",
      "type": "registry:component",
      "target": "components/overtrue/status-badge.tsx",
      "content": "import type { ComponentProps, ReactNode } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nconst variants = {\n  success:\n    \"bg-emerald-500/10 text-emerald-700 ring-emerald-600/20 dark:bg-emerald-400/10 dark:text-emerald-300 dark:ring-emerald-400/25\",\n  warning:\n    \"bg-amber-500/10 text-amber-700 ring-amber-600/20 dark:bg-amber-400/10 dark:text-amber-300 dark:ring-amber-400/25\",\n  // Tinted text leans toward the foreground so it stays legible on its own tint.\n  error:\n    \"bg-destructive/10 text-[color-mix(in_oklab,var(--color-destructive)_85%,var(--color-foreground))] ring-destructive/20 dark:ring-destructive/30\",\n  info: \"bg-primary/10 text-[color-mix(in_oklab,var(--color-primary)_85%,var(--color-foreground))] ring-primary/20 dark:ring-primary/30\",\n  neutral:\n    \"bg-muted/70 text-[color-mix(in_oklab,var(--color-muted-foreground)_85%,var(--color-foreground))] ring-border dark:bg-muted/50\",\n};\nconst dots = {\n  success: \"bg-emerald-500 dark:bg-emerald-400\",\n  warning: \"bg-amber-500 dark:bg-amber-400\",\n  error: \"bg-destructive\",\n  info: \"bg-primary\",\n  neutral: \"bg-muted-foreground/70\",\n};\nconst styles = `@keyframes status-badge-pulse{0%{transform:scale(1);opacity:.6}70%,100%{transform:scale(2.75);opacity:0}}`;\n\nexport interface StatusBadgeProps\n  extends Omit<ComponentProps<\"span\">, \"children\"> {\n  children: ReactNode;\n  variant?: keyof typeof variants;\n  /** Pulse the dot softly for states that are happening right now. */\n  live?: boolean;\n}\n\nexport function StatusBadge({\n  children,\n  variant = \"neutral\",\n  live = false,\n  className,\n  ...props\n}: StatusBadgeProps) {\n  return (\n    <span\n      data-slot=\"status-badge\"\n      data-variant={variant}\n      data-live={live || undefined}\n      className={cn(\n        \"inline-flex items-center gap-1.5 whitespace-nowrap rounded-full py-0.5 pr-2.5 pl-2 text-xs leading-5 font-medium tabular-nums ring-1 ring-inset\",\n        variants[variant],\n        className,\n      )}\n      {...props}\n    >\n      {live ? (\n        <style href=\"overtrue-status-badge\" precedence=\"default\">\n          {styles}\n        </style>\n      ) : null}\n      <span\n        aria-hidden=\"true\"\n        data-slot=\"status-badge-dot\"\n        className=\"relative flex size-1.5 shrink-0\"\n      >\n        {live ? (\n          <span\n            className={cn(\n              \"absolute inset-0 rounded-full motion-safe:animate-[status-badge-pulse_2s_cubic-bezier(0.22,1,0.36,1)_infinite] motion-reduce:hidden\",\n              dots[variant],\n            )}\n          />\n        ) : null}\n        <span className={cn(\"relative size-1.5 rounded-full\", dots[variant])} />\n      </span>\n      {children}\n    </span>\n  );\n}\n"
    },
    {
      "path": "src/registry/overtrue/uptime-history.tsx",
      "type": "registry:component",
      "target": "components/overtrue/uptime-history.tsx",
      "content": "\"use client\";\nimport { useId, type ComponentProps } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport type AvailabilityStatus =\n  \"operational\" | \"degraded\" | \"outage\" | \"unknown\";\nexport interface UptimeSample {\n  id: string;\n  label: string;\n  status: AvailabilityStatus;\n}\nconst colors: Record<AvailabilityStatus, string> = {\n  operational: \"bg-emerald-500/70\",\n  degraded: \"bg-amber-500/70\",\n  outage: \"bg-destructive\",\n  unknown: \"bg-muted-foreground/30\",\n};\nexport function UptimeHistory({\n  samples,\n  label,\n  startLabel,\n  endLabel,\n  className,\n  ...props\n}: Omit<ComponentProps<\"div\">, \"children\"> & {\n  samples: readonly UptimeSample[];\n  label: string;\n  startLabel?: string;\n  endLabel?: string;\n}) {\n  const id = useId();\n  return (\n    <div\n      data-slot=\"uptime-history\"\n      className={cn(\"min-w-0 space-y-2\", className)}\n      {...props}\n    >\n      {samples.length ? (\n        <>\n          <div\n            role=\"img\"\n            aria-label={label}\n            aria-describedby={id}\n            className=\"flex h-7 gap-0.5\"\n          >\n            {samples.map((sample) => (\n              <span\n                key={sample.id}\n                title={`${sample.label}: ${sample.status}`}\n                className={cn(\n                  \"min-w-0 flex-1 rounded-sm\",\n                  colors[sample.status],\n                )}\n              />\n            ))}\n          </div>\n          <ul id={id} className=\"sr-only\">\n            {samples.map((sample) => (\n              <li key={sample.id}>\n                {sample.label}: {sample.status}\n              </li>\n            ))}\n          </ul>\n        </>\n      ) : (\n        <p className=\"text-xs text-muted-foreground\">\n          No availability data yet.\n        </p>\n      )}\n      {(startLabel || endLabel) && (\n        <div className=\"flex justify-between gap-3 text-xs text-muted-foreground\">\n          <span>{startLabel}</span>\n          <span>{endLabel}</span>\n        </div>\n      )}\n    </div>\n  );\n}\n"
    }
  ],
  "docs": "Documentation: https://ui.overtrue.xyz/blocks/service-status. Requires an initialized shadcn/ui project with Tailwind CSS v4."
}
