{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "spinner",
  "title": "Spinner",
  "description": "A small spinning ring that says an action is under way, inline: in a field's adornment, a toast's or a menu entry's icon, or beside the words that say what is happening.",
  "registryDependencies": [
    "@ouro/lib-appearance-hints",
    "@ouro/lib-class-name-check",
    "@ouro/lib-cn",
    "@ouro/lib-env",
    "@ouro/lib-tones",
    "@ouro/lib-use-dev-messages"
  ],
  "files": [
    {
      "path": "registry/ouro/components/ouro/spinner/spinner.tsx",
      "content": "\"use client\";\n\nimport type { HTMLAttributes, JSX, Ref } from \"react\";\nimport { toneFor } from \"@/registry/ouro/lib/ouro/appearance-hints\";\nimport { useAppearanceClassNameCheck } from \"@/registry/ouro/lib/ouro/class-name-check\";\nimport { cn } from \"@/registry/ouro/lib/ouro/cn\";\nimport { toneWarning } from \"@/registry/ouro/lib/ouro/tones\";\nimport { useDevWarnings } from \"@/registry/ouro/lib/ouro/use-dev-messages\";\n\n/** The props Spinner adds to the `<span>` attributes it passes through. */\nexport interface SpinnerOwnProps {\n  /**\n   * What is loading, for screen readers: \"Loading recipes\". It is not shown; put visible\n   * text next to the spinner when you want one.\n   * @default \"Loading\"\n   */\n  label?: string | undefined;\n  /**\n   * The spinner's size: 16px, 20px or 32px. To match running text, use `sm`.\n   * @default \"md\"\n   * @claim \"The spinner's size: 16px, 20px or\" registry/ouro/components/ouro/spinner/spinner.test.tsx verify:testExists(registry/ouro/components/ouro/spinner/spinner.test.tsx::Spinner > sizes 16, 20 and 32px, md by default)\n   */\n  size?: \"sm\" | \"md\" | \"lg\" | (string & { 'Use \"sm\", \"md\" or \"lg\"': never }) | undefined;\n  /**\n   * Color role from the theme, named after its token. Without a tone the spinner takes the\n   * surrounding text color, so it matches the button or text it sits in. `secondary` is\n   * the muted foreground.\n   */\n  tone?:\n    | \"primary\"\n    | \"secondary\"\n    | \"destructive\"\n    | \"success\"\n    | \"warning\"\n    | (string & { 'danger is \"destructive\"; accent is \"primary\"; neutral is \"secondary\"': never })\n    | undefined;\n  /** Layout only: margins, alignment in a flex row (`ms-2`). Appearance classes warn in development; use `tone` and `size`. */\n  className?: string | undefined;\n  ref?: Ref<HTMLSpanElement> | undefined;\n\n  /** Not a prop. Ouro UI uses `tone`: `<Spinner tone=\"primary\">`. */\n  color?: { 'Use <Spinner tone=\"primary\">': never };\n}\n\n/** Props for {@link Spinner}: its own props and the `<span>` attributes it passes through. */\nexport type SpinnerProps = Omit<HTMLAttributes<HTMLSpanElement>, keyof SpinnerOwnProps | \"children\" | \"role\"> & SpinnerOwnProps;\n\n// Class strings are literal so the app's Tailwind finds them when it compiles.\nconst sizes = { sm: \"size-4\", md: \"size-5\", lg: \"size-8\" } as const;\n\nconst tones = {\n  primary: \"text-primary\",\n  secondary: \"text-muted-foreground\",\n  destructive: \"text-destructive\",\n  success: \"text-success\",\n  warning: \"text-warning\",\n} as const;\n\nfunction spinnerHint(token: string): string {\n  if (/^text-(xs|sm|base|lg|\\d?xl)$/.test(token)) return 'size=\"sm\", size=\"md\" or size=\"lg\"';\n  return `tone=\"${toneFor(token)}\"`;\n}\n\n/**\n * A small spinning ring that says an action is under way, inline: in a field's adornment, a\n * toast's or a menu entry's icon, or beside the words that say what is happening. Screen\n * readers hear its `label` as a status; with reduced motion it pulses instead of spinning.\n *\n * Use `Skeleton` instead to hold the place of content that is loading (a spinner alone where\n * content will be fails the source rule's `content-spinner`), `Button`'s `loading` when the\n * wait follows a press, and `Progress` when you know how far along the work is.\n *\n * @group Feedback\n * @see https://ui.ouroboros.bot/docs/spinner\n *\n * @example\n * <TextField label=\"Find\" endAdornment={<Spinner size=\"sm\" label=\"Searching\" />} />\n */\nexport function Spinner(props: SpinnerProps): JSX.Element {\n  const { label = \"Loading\", size: sizeProp = \"md\", tone: toneProp, className, color, ...rest } = props;\n  // A size or tone that is not one of Ouro UI's (a type error) warns and renders the default.\n  const size = Object.hasOwn(sizes, sizeProp) ? (sizeProp as keyof typeof sizes) : \"md\";\n  const tone = toneProp !== undefined && Object.hasOwn(tones, toneProp) ? (toneProp as keyof typeof tones) : undefined;\n  useAppearanceClassNameCheck(\n    \"Spinner\",\n    className,\n    process.env.NODE_ENV !== \"production\" ? spinnerHint : /* istanbul ignore next @preserve -- production only */ \"\",\n  );\n  useDevWarnings(\n    \"Spinner\",\n    process.env.NODE_ENV !== \"production\"\n      ? () => [\n          size !== sizeProp && [`size=\"${String(sizeProp)}\" is not a size; use \"sm\", \"md\", \"lg\"`, '<Spinner size=\"md\">'],\n          toneProp !== undefined && tone !== toneProp && toneWarning(\"Spinner\", String(toneProp), Object.keys(tones)),\n          color !== undefined && [\"color is not a prop\", `<Spinner tone=\"${toneFor(`text-${String(color)}`)}\">`],\n        ]\n      : /* istanbul ignore next @preserve -- production only */ undefined,\n  );\n  return (\n    <span\n      {...rest}\n      role=\"status\"\n      data-ouro=\"spinner\"\n      className={cn(\"relative inline-flex shrink-0 align-middle\", sizes[size], tone && tones[tone], className)}\n    >\n      <svg\n        aria-hidden=\"true\"\n        viewBox=\"0 0 24 24\"\n        fill=\"none\"\n        className=\"size-full animate-[ouro-spin_0.8s_linear_infinite] motion-reduce:animate-[ouro-pulse_1.6s_ease-in-out_infinite]\"\n      >\n        <circle cx=\"12\" cy=\"12\" r=\"9\" stroke=\"currentColor\" strokeWidth=\"2.5\" opacity=\"0.25\" />\n        <path d=\"M21 12a9 9 0 0 0-9-9\" stroke=\"currentColor\" strokeWidth=\"2.5\" strokeLinecap=\"round\" />\n      </svg>\n      <span className=\"sr-only\">{label}</span>\n    </span>\n  );\n}\n",
      "type": "registry:ui",
      "target": "@components/ouro/spinner/spinner.tsx"
    }
  ],
  "docs": "A small spinning ring that says an action is under way, inline: in a field's adornment, a toast's or a menu entry's icon, or beside the words that say what is happening. Import: import { Spinner } from \"@/components/ouro/spinner/spinner\", with @/components replaced by your components alias (aliases.components in components.json, such as ~/components). Also installed: the helpers it imports in lib/ouro. Needs ouro-base in your stylesheet: add that item once per app, from the same place as this one, if you have not. Docs: https://ui.ouroboros.bot/docs/spinner.md Ouro UI v1.3.257.",
  "type": "registry:ui"
}