{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "spinner",
  "title": "Spinner",
  "description": "Ring spinner and loading dots that take their colour from the surrounding text.",
  "dependencies": [
    "class-variance-authority@^0.7.1"
  ],
  "registryDependencies": [
    "@pestoui/style",
    "@pestoui/utils"
  ],
  "files": [
    {
      "path": "pestoui/ui/spinner.tsx",
      "content": "import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\n/* A CSS ring rather than an icon, so it takes its colour from whatever it\n   sits inside — a button label, muted body text, a destructive tint.\n   The faint full border is the track; the solid top edge is the head.\n\n   The rotation stays linear on purpose. A continuous loop has no start and no\n   end to ease into, so any easing shows up as a stutter every time the head\n   crosses the seam. */\nconst spinnerVariants = cva(\n  \"inline-block shrink-0 animate-spin rounded-full border-current/20 border-t-current align-middle\",\n  {\n    variants: {\n      size: {\n        xs: \"size-3 border-[1.5px]\",\n        sm: \"size-4 border-2\",\n        default: \"size-5 border-2\",\n        lg: \"size-7 border-[2.5px]\",\n      },\n    },\n    defaultVariants: {\n      size: \"default\",\n    },\n  }\n)\n\nfunction Spinner({\n  className,\n  size = \"default\",\n  label = \"Loading\",\n  ...props\n}: Omit<React.ComponentProps<\"span\">, \"children\"> &\n  VariantProps<typeof spinnerVariants> & {\n    label?: string\n  }) {\n  return (\n    <span\n      data-slot=\"spinner\"\n      data-size={size}\n      role=\"status\"\n      className={cn(spinnerVariants({ size }), className)}\n      {...props}\n    >\n      <span className=\"sr-only\">{label}</span>\n    </span>\n  )\n}\n\n/* Inline pending state — quieter than a spinner, reads as \"still typing\". */\nconst loadingDotsVariants = cva(\n  \"inline-flex items-center align-middle *:data-[slot=loading-dot]:animate-bounce *:data-[slot=loading-dot]:rounded-full *:data-[slot=loading-dot]:bg-current\",\n  {\n    variants: {\n      size: {\n        xs: \"gap-0.5 *:data-[slot=loading-dot]:size-1\",\n        sm: \"gap-0.5 *:data-[slot=loading-dot]:size-1.5\",\n        default: \"gap-1 *:data-[slot=loading-dot]:size-2\",\n        lg: \"gap-1.5 *:data-[slot=loading-dot]:size-2.5\",\n      },\n    },\n    defaultVariants: {\n      size: \"default\",\n    },\n  }\n)\n\n/* One stagger unit per dot, so the wave is a token rather than three typed\n   numbers and it flattens to nothing when motion is reduced. */\nconst loadingDotOffsets = [0, 1, 2]\n\nfunction LoadingDots({\n  className,\n  size = \"default\",\n  label = \"Loading\",\n  ...props\n}: Omit<React.ComponentProps<\"span\">, \"children\"> &\n  VariantProps<typeof loadingDotsVariants> & {\n    label?: string\n  }) {\n  return (\n    <span\n      data-slot=\"loading-dots\"\n      data-size={size}\n      role=\"status\"\n      className={cn(loadingDotsVariants({ size }), className)}\n      {...props}\n    >\n      {loadingDotOffsets.map((offset) => (\n        <span\n          key={offset}\n          data-slot=\"loading-dot\"\n          aria-hidden=\"true\"\n          /* Inline delay beats the animation shorthand the utility sets. */\n          style={{ animationDelay: `calc(var(--stagger-loose) * ${offset})` }}\n        />\n      ))}\n      <span className=\"sr-only\">{label}</span>\n    </span>\n  )\n}\n\nexport { Spinner, spinnerVariants, LoadingDots, loadingDotsVariants }\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}