{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "integration-list",
  "type": "registry:block",
  "title": "Integration list",
  "description": "Workspace connections with account details, async actions, and failure feedback that keeps retry within reach.",
  "categories": [
    "blocks"
  ],
  "dependencies": [
    "@tabler/icons-react"
  ],
  "registryDependencies": [
    "card",
    "button"
  ],
  "files": [
    {
      "path": "src/registry/overtrue/integration-list.tsx",
      "type": "registry:component",
      "target": "components/overtrue/integration-list.tsx",
      "content": "\"use client\";\nimport { useRef, useState, type ReactNode } from \"react\";\nimport { IconPlug, IconLoader2 } from \"@tabler/icons-react\";\nimport { Button } from \"@/components/ui/button\";\nimport { SectionCard } from \"./section-card\";\nimport { StatusBadge } from \"./status-badge\";\n\nexport interface Integration {\n  id: string;\n  name: string;\n  description: string;\n  icon?: ReactNode;\n  connected: boolean;\n  account?: string;\n}\n\nexport interface IntegrationListProps {\n  integrations: readonly Integration[];\n  onConnectionChange?: (id: string, connected: boolean) => void | Promise<void>;\n  className?: string;\n}\n\nfunction IntegrationRow({\n  integration,\n  onConnectionChange,\n}: {\n  integration: Integration;\n  onConnectionChange: IntegrationListProps[\"onConnectionChange\"];\n}) {\n  const [pending, setPending] = useState(false);\n  const [failed, setFailed] = useState(false);\n  const inFlight = useRef(false);\n  const { id, name, description, icon, connected, account } = integration;\n  const action = connected ? \"Disconnect\" : \"Connect\";\n\n  async function changeConnection() {\n    if (!onConnectionChange || inFlight.current) return;\n    inFlight.current = true;\n    setPending(true);\n    setFailed(false);\n    try {\n      await onConnectionChange(id, !connected);\n    } catch {\n      setFailed(true);\n    } finally {\n      inFlight.current = false;\n      setPending(false);\n    }\n  }\n\n  return (\n    <li className=\"grid grid-cols-[2.25rem_minmax(0,1fr)] items-start gap-x-3 gap-y-3 py-5 sm:grid-cols-[2.25rem_minmax(0,1fr)_auto]\">\n      <span\n        aria-hidden=\"true\"\n        className=\"flex size-9 items-center justify-center rounded-lg border border-border bg-background text-foreground [&_svg]:size-5\"\n      >\n        {icon ?? <IconPlug />}\n      </span>\n      <div className=\"min-w-0\">\n        <p className=\"m-0 text-sm font-medium leading-5 [overflow-wrap:anywhere]\">\n          {name}\n        </p>\n        <p className=\"m-0 mt-1 text-xs leading-5 text-muted-foreground [overflow-wrap:anywhere]\">\n          {description}\n        </p>\n        <div\n          aria-live=\"polite\"\n          className=\"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground\"\n        >\n          <StatusBadge variant={connected ? \"success\" : \"neutral\"}>\n            {connected ? \"Connected\" : \"Not connected\"}\n          </StatusBadge>\n          {connected && account && (\n            <span className=\"min-w-0 [overflow-wrap:anywhere]\">{account}</span>\n          )}\n        </div>\n        {failed && (\n          <p\n            role=\"alert\"\n            className=\"m-0 mt-2 text-xs leading-5 text-destructive\"\n          >\n            Could not update {name}. Please try again.\n          </p>\n        )}\n      </div>\n      {onConnectionChange && (\n        <Button\n          type=\"button\"\n          size=\"sm\"\n          variant=\"outline\"\n          className=\"col-start-2 w-fit shadow-none sm:col-start-3\"\n          aria-label={`${action} ${name}`}\n          aria-busy={pending}\n          disabled={pending}\n          onClick={changeConnection}\n        >\n          {pending && (\n            <IconLoader2\n              aria-hidden=\"true\"\n              className=\"size-4 animate-spin motion-reduce:animate-none\"\n            />\n          )}\n          {pending ? \"Updating…\" : action}\n        </Button>\n      )}\n    </li>\n  );\n}\n\n/** A controlled workspace integrations block; the caller owns connection state. */\nexport function IntegrationList({\n  integrations,\n  onConnectionChange,\n  className,\n}: IntegrationListProps) {\n  const connectedCount = integrations.filter(\n    (integration) => integration.connected,\n  ).length;\n  return (\n    <SectionCard\n      title={\n        <span className=\"flex flex-wrap items-center justify-between gap-x-3 gap-y-1\">\n          <span>Integrations</span>\n          <span className=\"text-xs font-normal text-muted-foreground\">\n            {connectedCount} connected\n          </span>\n        </span>\n      }\n      description=\"Connect the tools your team works with.\"\n      className={className}\n      contentClassName=\"p-0\"\n    >\n      {integrations.length ? (\n        <ul className=\"m-0 list-none divide-y divide-border px-5\">\n          {integrations.map((integration) => (\n            <IntegrationRow\n              key={integration.id}\n              integration={integration}\n              onConnectionChange={onConnectionChange}\n            />\n          ))}\n        </ul>\n      ) : (\n        <p className=\"m-0 px-5 py-10 text-center text-sm text-muted-foreground\">\n          No integrations available yet.\n        </p>\n      )}\n    </SectionCard>\n  );\n}\n"
    },
    {
      "path": "src/registry/overtrue/section-card.tsx",
      "type": "registry:component",
      "target": "components/overtrue/section-card.tsx",
      "content": "import type { ComponentProps, ReactNode } from \"react\";\nimport {\n  Card,\n  CardContent,\n  CardHeader,\n  CardTitle,\n  CardDescription,\n} from \"@/components/ui/card\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface SectionCardProps extends Omit<\n  ComponentProps<typeof Card>,\n  \"title\"\n> {\n  title?: ReactNode;\n  description?: ReactNode;\n  actions?: ReactNode;\n  contentClassName?: string;\n}\n\n/** A shared heading, actions and content surface for admin panels. */\nexport function SectionCard({\n  title,\n  description,\n  actions,\n  children,\n  className,\n  contentClassName,\n  ...props\n}: SectionCardProps) {\n  return (\n    <Card\n      data-slot=\"section-card\"\n      className={cn(\n        \"min-w-0 gap-0 rounded-2xl border border-border/70 bg-card py-0 text-card-foreground ring-0\",\n        \"shadow-[0_1px_2px_rgb(0_0_0/0.04),0_8px_24px_-12px_rgb(0_0_0/0.10)] dark:shadow-[inset_0_1px_0_rgb(255_255_255/0.05),0_1px_2px_rgb(0_0_0/0.5)]\",\n        className,\n      )}\n      {...props}\n    >\n      {(title || description || actions) && (\n        <CardHeader className=\"flex flex-row flex-wrap items-center justify-between gap-x-4 gap-y-3 border-b border-border/60 px-5 py-4 [.border-b]:pb-4\">\n          <div data-slot=\"section-card-heading\" className=\"min-w-0 flex-1\">\n            {title && (\n              <CardTitle className=\"m-0 text-sm leading-6 font-semibold tracking-tight text-card-foreground\">\n                {title}\n              </CardTitle>\n            )}\n            {description && (\n              <CardDescription className=\"m-0 mt-0.5 text-[13px] leading-5 text-muted-foreground\">\n                {description}\n              </CardDescription>\n            )}\n          </div>\n          {actions && (\n            <div\n              data-slot=\"section-card-actions\"\n              className=\"flex shrink-0 items-center gap-2\"\n            >\n              {actions}\n            </div>\n          )}\n        </CardHeader>\n      )}\n      <CardContent className={cn(\"p-5\", contentClassName)}>\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"
    }
  ],
  "docs": "Documentation: https://ui.overtrue.xyz/blocks/integration-list. Requires an initialized shadcn/ui project with Tailwind CSS v4."
}
