{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "spinner",
  "type": "registry:ui",
  "title": "Spinner",
  "description": "Something is working and there is no number to show yet. The shadcn core `spinner` item, drawn in Interlace tokens. Use `Progress` when you know how far along it is, and `Skeleton` when you know the shape of what is coming.",
  "author": "ofri-peretz <https://github.com/ofri-peretz>",
  "categories": [
    "feedback",
    "primitive"
  ],
  "dependencies": [
    "class-variance-authority"
  ],
  "registryDependencies": [
    "https://ds.interlace.tools/r/interlace-base.json",
    "https://ds.interlace.tools/r/cn.json"
  ],
  "files": [
    {
      "path": "registry/interlace-ui/spinner.tsx",
      "target": "components/ui/spinner.tsx",
      "type": "registry:ui",
      "content": "import * as React from 'react';\n\n// @interlace/spinner v1.0.0 — Interlace design system.\n// Docs, props and live preview: https://ds.interlace.tools/c/spinner\n// What changed since: https://ds.interlace.tools/c/spinner#history\n// Generated banner — keep it, the upgrade diff reads this version.\n\n/**\n * @interlace/ui — Spinner\n *\n * Something is working and there is no number to show yet. The shadcn core\n * `spinner` item, drawn in Interlace tokens. Use `Progress` when you know how\n * far along it is, and `Skeleton` when you know the shape of what is coming.\n *\n * Server component — an inline SVG, nothing to hydrate.\n *\n * ## Anatomy\n *\n *   Spinner                          (svg role=status — data-min-viewport=320)\n *     ├─ circle                      (the track, faint)\n *     └─ path                        (the arc that turns)\n *\n * ## Announced, once\n *\n * `role=\"status\"` is a polite live region: a screen reader announces the\n * `label` (\"Loading\" by default) when the spinner is inserted after the page\n * has loaded, as in `{isLoading && <Spinner />}` driven by client state. A\n * spinner already in the server HTML is not announced; it is read in order\n * like any other text. Pass `label` in the page's language. When the spinner\n * sits next to text that already says what is happening (\"Saving your\n * changes\"), or inside a button with `aria-busy`, pass `decorative` so it is\n * hidden and nothing is read twice.\n *\n * ## Motion\n *\n * The arc turns only under `motion-safe`. With reduced motion it holds\n * still, and the label still says it is loading: the turn adds nothing the\n * reader needs.\n *\n * ## Colour\n *\n * `currentColor`, so it takes the colour of the text around it, on a button,\n * a banner or plain body copy. The track is the same colour at low opacity.\n *\n * ## MIN_VIEWPORT — 320\n *\n * A fixed square at most 32px wide; it never wraps.\n *\n * | Rule | Concept                 | Where in this file                                |\n * | ---- | ----------------------- | ------------------------------------------------- |\n * | R4   | Extends native el       | `React.ComponentProps<'svg'> & VariantProps`      |\n * | R6   | data-slot               | `spinner`                                         |\n * | R7   | cva + cn + ...rest      | `cn(spinnerVariants({ size }), className)`        |\n * | R8   | Enums, not booleans     | `size` = sm \\| md \\| lg                           |\n * | R14  | Declares min viewport   | `data-min-viewport` + exported const              |\n * | R19  | Tokens only             | `currentColor`; `motion-safe:animate-spin`        |\n * | R25  | Server component        | no hooks → no `'use client'`                      |\n * | R26  | A11y                    | `role=\"status\"` + `aria-label`, or `aria-hidden`  |\n */\n\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '@/lib/utils';\n\n/** Minimum viable viewport (CSS px) for this primitive. */\nexport const MIN_VIEWPORT = 320 as const;\n\nconst spinnerVariants = cva('inline-block shrink-0 motion-safe:animate-spin', {\n  variants: {\n    size: {\n      sm: 'size-4',\n      md: 'size-6',\n      lg: 'size-8',\n    },\n  },\n  defaultVariants: { size: 'sm' },\n});\n\ntype SpinnerProps = Omit<React.ComponentProps<'svg'>, 'children'> &\n  VariantProps<typeof spinnerVariants> & {\n    /** What is announced when the spinner appears, in the page's language. @default 'Loading' */\n    label?: string;\n    /**\n     * Hide it from assistive tech, for a spinner inside something that already says it\n     * is busy (a button with `aria-busy`). @default false\n     */\n    decorative?: boolean;\n  };\n\nfunction Spinner({ className, size, label = 'Loading', decorative = false, ...props }: SpinnerProps) {\n  const a11y = decorative\n    ? ({ 'aria-hidden': true } as const)\n    : ({ role: 'status', 'aria-label': label } as const);\n  return (\n    <svg\n      data-slot=\"spinner\"\n      data-min-viewport={String(MIN_VIEWPORT)}\n      viewBox=\"0 0 24 24\"\n      fill=\"none\"\n      stroke=\"currentColor\"\n      strokeWidth={2.5}\n      strokeLinecap=\"round\"\n      focusable=\"false\"\n      className={cn(spinnerVariants({ size }), className)}\n      {...a11y}\n      {...props}\n    >\n      <circle cx=\"12\" cy=\"12\" r=\"9\" opacity={0.2} />\n      <path d=\"M21 12a9 9 0 0 0-9-9\" />\n    </svg>\n  );\n}\n\nexport { Spinner, spinnerVariants };\nexport type { SpinnerProps };\n"
    }
  ],
  "meta": {
    "tier": "primitive",
    "client": false,
    "minViewport": 320,
    "loading": false,
    "version": "1.0.0",
    "since": "2.0.0"
  },
  "docs": "## @interlace/spinner\n\nInstalled to `components/ui/spinner.tsx`.\n\n```tsx\nimport { /* … */ } from '@/components/ui/spinner';\n```\n\nProps, a11y contract, live preview and source: https://ds.interlace.tools/c/spinner\n\nRequires the `@interlace/interlace-base` CSS baseline (installed automatically as a registry dependency). For the Interlace look, also add `@interlace/theme`."
}
