{
  "name": "status-indicator",
  "type": "registry:ui",
  "framework": "react",
  "title": "Status Indicator",
  "description": "A presence dot anchored to an avatar, with online, idle, do-not-disturb, offline and streaming states.",
  "dependencies": [
    "class-variance-authority"
  ],
  "registryDependencies": [
    "@newtui/avatar"
  ],
  "files": [
    {
      "path": "ui/status-indicator.tsx",
      "content": "import { cva, type VariantProps } from \"class-variance-authority\"\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst PULSE_KEYFRAMES = `@keyframes newt-presence-pulse{0%{transform:scale(.7);opacity:.6}70%{transform:scale(1.6);opacity:0}100%{transform:scale(1.6);opacity:0}}`\n\n/*\n * The box that anchors the dot to the avatar. It has no role: a member list\n * draws one per row, and a live region per row would announce every change.\n * The state is spoken by the `label` of the dot.\n */\nconst StatusIndicator = React.forwardRef<\n  HTMLDivElement,\n  React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => (\n  <div\n    ref={ref}\n    className={cn(\"relative inline-block\", className)}\n    {...props}\n  />\n))\nStatusIndicator.displayName = \"StatusIndicator\"\n\n/*\n * The ring cuts the dot out of the avatar. Set `--newt-status-ring` to the\n * colour of the surface behind the avatar when it is not the base surface.\n */\nconst statusDotVariants = cva(\n  \"absolute -bottom-0.5 -end-0.5 h-3.5 w-3.5 rounded-full border-[3px] border-[color:var(--newt-status-ring,var(--newt-bg-base))]\",\n  {\n    variants: {\n      status: {\n        online:\n          \"bg-newt-online after:pointer-events-none after:absolute after:-inset-1 after:rounded-full after:border-[1.5px] after:border-newt-online after:opacity-0 after:content-[''] after:[animation:newt-presence-pulse_2.4s_ease-out_infinite] motion-reduce:after:[animation:none]\",\n        idle: \"bg-[color:var(--newt-status-ring,var(--newt-bg-base))] after:absolute after:inset-0 after:rounded-full after:bg-newt-idle after:content-[''] after:[clip-path:circle(60%_at_35%_35%)]\",\n        dnd: \"bg-[color:var(--newt-status-ring,var(--newt-bg-base))] after:absolute after:start-1/2 after:top-1/2 after:h-[22%] after:w-[65%] after:-translate-x-1/2 after:-translate-y-1/2 after:rounded-[1px] after:bg-newt-dnd after:content-['']\",\n        offline: \"bg-newt-offline\",\n        streaming: \"bg-newt-streaming\",\n      },\n    },\n    defaultVariants: {\n      status: \"offline\",\n    },\n  }\n)\n\nexport interface StatusDotProps\n  extends React.ComponentProps<\"div\">, VariantProps<typeof statusDotVariants> {\n  /**\n   * The state in words, such as \"Online\". It is read by a screen reader and\n   * not shown. Leave it out when the state is already written beside the dot.\n   */\n  label?: string\n}\n\nconst StatusDot = React.forwardRef<HTMLDivElement, StatusDotProps>(\n  ({ className, status, label, children, ...props }, ref) => (\n    <>\n      {status === \"online\" ? (\n        <style dangerouslySetInnerHTML={{ __html: PULSE_KEYFRAMES }} />\n      ) : null}\n      <div\n        ref={ref}\n        data-status={status ?? \"offline\"}\n        className={cn(statusDotVariants({ status }), className)}\n        {...props}\n      >\n        {label === undefined ? null : <span className=\"sr-only\">{label}</span>}\n        {children}\n      </div>\n    </>\n  )\n)\nStatusDot.displayName = \"StatusDot\"\n\nexport { StatusIndicator, StatusDot, statusDotVariants }\n",
      "type": "registry:ui"
    }
  ]
}