{
  "timestamp": "2026-11-19T09:33:56",
  "compiler": {
    "name": "@stencil/core",
    "version": "4.45.4",
    "typescriptVersion": "5.8.3"
  },
  "storybook": "https://magma-design-system.github.io/magma/storybook/",
  "studio": "https://magma-design-system.github.io/magma/studio/",
  "components": [
    {
      "filePath": "src/components/mds-spinner/mds-spinner.tsx",
      "encapsulation": "shadow",
      "tag": "mds-spinner",
      "docs": "This is a web-component from Maggioli Design System [Magma](https://magma.maggiolicloud.it), built with StencilJS, TypeScript, Storybook. It's based on the web-component standard and it's designed to be agnostic from the JavaScript framework you are using.",
      "docsTags": [
        {
          "name": "category",
          "text": "feedback"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-spinner>` web component is the Magma Design System's loading/await indicator: a self-contained, animated SVG spinner used standalone or embedded inside host components (`mds-button`, `mds-input`, `mds-entity`) to signal an in-progress, indeterminate operation. It has no HTML primitive equivalent and exposes no text content.\n\n#### Semantic Behavior\n\n- **Visibility is gated by `running`**: When `running` is absent/false the spinner is hidden and its animation is paused; setting `running` reveals it and starts the animation. The animation never runs while hidden, for performance.\n- **No interactivity or accessibility role**: It is decorative - not focusable, emits no events, has no ARIA role, and is not form-associated. Any loading semantics (e.g. `aria-busy`) must be set by the surrounding context.\n- **Reduced-motion and contrast aware**: The animation slows down (8s per turn, it never stops) when the Magma animation preference reduces motion (`pref-animation-reduce`, `mds-pref-animation`, or the OS `prefers-reduced-motion` under `system`), and the color is strengthened under the contrast preference, without consumer intervention.\n\n#### Properties & Visual Configurations\n\nThe component exposes a single behavioral prop:\n\n- **`running`** is the master switch that both shows the spinner and runs its animation; treat it as a boolean presence attribute and drive it from the consuming component's loading/await state rather than toggling visibility manually.\n\n#### Other behavioral props\n\n- **`--mds-spinner-duration`** (CSS custom property, default `0.725s`) tunes the rotation speed of the spin animation; override it on the host to slow down or speed up the indicator without touching markup.\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-spinner>` component, ordered from most common to most specialized. The examples assume a working knowledge of the shared component rules in [`agents/conventions.md`](../../../../agents/conventions.md).\n\n#### Basic Spinner\n\nA spinner shows and animates while `running` is set.\n\n```html\n<mds-spinner running></mds-spinner>\n```\n\nWithout `running` the component is invisible and its animation paused. Render it into the DOM early and set `running` when a request starts; removing the attribute (or setting the prop to `undefined`) hides it again when done.\n\n```html\n<!-- Rendered early, hidden until a request starts -->\n<mds-spinner></mds-spinner>\n```\n\n#### Inline Loading Indicator\n\nPlace the spinner next to a label to signal that a section is loading. The spinner is painted in the accent color (`--magma-accent-fg`) by default; set `color` on the host to match the surrounding text instead.\n\n```html\n<div class=\"loading-row\">\n  <mds-spinner running></mds-spinner>\n  <span>Caricamento dati in corso...</span>\n</div>\n```\n\n#### Full-Page or Overlay Loading State\n\nCentre the spinner over a region with a wrapper. Drive `running` programmatically - set it when the async operation starts, remove it when done.\n\n```html\n<div class=\"overlay\">\n  <mds-spinner running></mds-spinner>\n</div>\n```\n\n```css\n.overlay {\n  align-items: center;\n  display: flex;\n  inset: 0;\n  justify-content: center;\n  position: absolute;\n}\n```\n\n#### Inside `mds-button` (via `await`)\n\n`mds-button` manages its own internal `<mds-spinner>` automatically through its `await` prop. Do not add a separate `<mds-spinner>` next to a button - use `await` on the button itself.\n\n```html\n<!-- While an async operation is in flight -->\n<mds-button label=\"Salvataggio in corso...\" await variant=\"primary\" tone=\"strong\"></mds-button>\n```\n\n#### Controlling Animation Speed\n\nUse the `--mds-spinner-duration` CSS custom property to tune the rotation speed. Set it on the host element - shorter values spin faster, longer values spin slower. Reduced motion still slows the spinner down to 8s per turn, whatever this property says.\n\n```css\n.fast-indicator mds-spinner {\n  --mds-spinner-duration: 0.4s;\n}\n\n.slow-indicator mds-spinner {\n  --mds-spinner-duration: 1.5s;\n}\n```\n\n#### Accessible Loading Region\n\n`<mds-spinner>` is purely decorative and carries no ARIA role. Announce the loading state to screen readers by adding `aria-busy` and `aria-live` on the surrounding container, not on the spinner itself.\n\n```html\n<section aria-busy=\"true\" aria-live=\"polite\" aria-label=\"Ricerca in corso\">\n  <mds-spinner running></mds-spinner>\n</section>\n```\n\n#### Colour Customization via CSS Color\n\nThe spinner stroke inherits `color` from the host, so you can recolour it without touching shadow internals. Use a semantic colour role so dark mode and high-contrast modes keep working.\n\n```css\n.status-warning-spinner mds-spinner {\n  color: rgb(var(--magma-warning-text-default));\n}\n```\n\n```html\n<div class=\"status-warning-spinner\">\n  <mds-spinner running></mds-spinner>\n</div>\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-spinner>`. Each entry pairs the wrong form with the right one and a one-line reason. System-wide rules (boolean-as-string, shadow piercing, Tailwind color utilities, raw native event listening) live in [`agents/mistakes.md`](../../../../agents/mistakes.md) - they apply here too but are not repeated.\n\n#### Do Not Set `running=\"false\"` to Hide the Spinner\n\nThe component's styles key on the presence of `running` (`:host([running])`). Stencil reads `\"false\"` as `false` and, since `running` is reflected, removes the attribute at the first render, so this happens to work; but the markup says the opposite of what it does, and on a prop that is not reflected the attribute stays in the DOM, where `[attr]` selectors still match it. Remove the attribute entirely - or set the prop to `undefined` - to stop and hide the spinner.\n\n```html\n<!-- INCORRECT -->\n<mds-spinner running=\"false\"></mds-spinner>\n\n<!-- CORRECT -->\n<mds-spinner></mds-spinner>\n```\n\n#### Do Not Show Spinner Without `running` and Expect It to Animate\n\nThe spinner renders as invisible (`opacity: 0`, `transform: scale(0)`) and with the animation paused when `running` is absent. Toggling CSS visibility or opacity from outside will not start the animation - you must set the `running` attribute.\n\n```html\n<!-- INCORRECT -->\n<mds-spinner style=\"opacity: 1; transform: none;\"></mds-spinner>\n\n<!-- CORRECT -->\n<mds-spinner running></mds-spinner>\n```\n\n#### Do Not Add ARIA Roles or Labels to the Spinner Itself\n\nThe spinner is decorative - it has no semantic content and must not become a labelled landmark or a status region. Screen readers should be informed of loading state through a parent container with `aria-busy` / `aria-live`, not through attributes placed on `<mds-spinner>`.\n\n```html\n<!-- INCORRECT -->\n<mds-spinner running role=\"status\" aria-label=\"Caricamento\"></mds-spinner>\n\n<!-- CORRECT -->\n<div role=\"status\" aria-live=\"polite\" aria-label=\"Caricamento\">\n  <mds-spinner running></mds-spinner>\n</div>\n```\n\n#### Do Not Add a Separate Spinner Alongside `mds-button`\n\n`mds-button` controls its own internal `<mds-spinner>` through the `await` prop. An extra spinner next to the button leaves the button clickable while the operation runs; `await` shows the button's own spinner and blocks interaction.\n\n```html\n<!-- INCORRECT -->\n<mds-button label=\"Salva\" variant=\"primary\"></mds-button>\n<mds-spinner running></mds-spinner>\n\n<!-- CORRECT -->\n<mds-button label=\"Salva\" await variant=\"primary\"></mds-button>\n```\n\n#### Do Not Pierce Shadow DOM to Change the SVG Colour\n\nThe only documented customization surface is the `color` CSS property on the host (inherited by the internal stroke) and the `--mds-spinner-duration` CSS custom property. Targeting internals via `>>>` or undocumented selectors couples your code to the implementation and will break on minor releases.\n\n```css\n/* INCORRECT */\nmds-spinner >>> .await-icon svg {\n  stroke: red;\n}\n\n/* CORRECT */\nmds-spinner {\n  color: rgb(var(--magma-danger-text-default));\n}\n```\n\n#### Do Not Override `--mds-spinner-duration` to Pause or Stop the Animation\n\nSetting an extremely long or `infinite` duration is not a supported way to pause the spinner. Use the `running` attribute to start and stop the animation - the component manages animation-play-state itself.\n\n```css\n/* INCORRECT */\nmds-spinner {\n  --mds-spinner-duration: 9999s;\n}\n```\n\n```html\n<!-- CORRECT - remove the attribute to stop -->\n<mds-spinner></mds-spinner>\n```\n"
      },
      "props": [
        {
          "name": "running",
          "type": "boolean | undefined",
          "complexType": {
            "original": "boolean",
            "resolved": "boolean | undefined",
            "references": {}
          },
          "mutable": true,
          "attr": "running",
          "reflectToAttr": true,
          "docs": "Specifies if the animation is running or not, it's required for performance reasons",
          "docsTags": [
            {
              "name": "default",
              "text": "false"
            }
          ],
          "default": "false",
          "values": [
            {
              "type": "boolean"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        }
      ],
      "methods": [],
      "events": [],
      "listeners": [],
      "styles": [
        {
          "name": "--mds-spinner-duration",
          "annotation": "prop",
          "docs": "Duration of the spinner animation.",
          "visibility": "public"
        }
      ],
      "slots": [],
      "parts": [],
      "states": [],
      "dependents": [
        "mds-button",
        "mds-entity",
        "mds-input"
      ],
      "dependencies": [],
      "dependencyGraph": {
        "mds-button": [
          "mds-spinner"
        ],
        "mds-entity": [
          "mds-spinner"
        ],
        "mds-input": [
          "mds-spinner"
        ]
      },
      "storybook": "ui-spinner--docs"
    }
  ]
}
