{
  "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-usage/mds-usage.tsx",
      "encapsulation": "shadow",
      "tag": "mds-usage",
      "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": "slot",
          "text": "- Add `text string`, `HTML elements` or `components` to this slot."
        },
        {
          "name": "part",
          "text": "header - The header that holds the `icon` and the `label`"
        },
        {
          "name": "part",
          "text": "icon - The icon of the header, the one of `variant` unless `icon` is set"
        },
        {
          "name": "part",
          "text": "label - The label of the header, the name of `variant` unless `alias` is set"
        },
        {
          "name": "category",
          "text": "content"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-usage>` web component is a documentation-oriented annotation block of the Magma Design System used to frame example content as a recommendation, a warning, or an informational note. It wraps slotted content in a labelled, status-colored container and has no native HTML primitive equivalent - it is a presentational guidance device, typically used inside design-system docs and Storybook.\n\n#### Semantic Behavior\n\n- **Status semantics via `variant`**: The chosen `variant` drives the border and header color from the shared status palette (success / info / error / warning) and the header icon (a tick for `do`, an X for `dont`, an info sign for `info`, a warning triangle for `warn`), so the container reads as the matching guidance category even without its color.\n- **Label first**: The header label (the `alias`, or the name of the `variant` in the page language) is what tells assistive technology the kind of guidance; the content region has no role of its own.\n- **Localized header label**: When `alias` is not provided, the header text is resolved from the bundled locale dictionary (el / en / es / it) keyed by `variant`, so the label follows the document language.\n- **Default slot is content**: The default (unnamed) slot accepts a text string, HTML elements, or other components - it is the body of the usage block, not the label.\n\n#### Properties & Visual Configurations\n\n`variant` is the primary configuration prop. Unlike most Magma components, this is NOT the shared variant/tone ladder defined in [`agents/variants.md`](../../../../agents/variants.md); it is a component-specific guidance category:\n\n- **`variant=\"do\"`**: marks recommended / allowed usage (success styling).\n- **`variant=\"dont\"`**: marks discouraged / disallowed usage (error styling).\n- **`variant=\"info\"`**: neutral informational note (info styling); this is the default.\n- **`variant=\"warn\"`**: cautionary note (warning styling).\n\nThe `variant` is reflected on the host, where the styles read it, so it colors the block when it is set as a property too (as the React and Angular wrappers set it); without one the host gets `info`.\n\n#### Other behavioral props\n\n- **`alias`** overrides the auto-generated, localized header phrase with a custom string when the default category label is not specific enough for the example being shown.\n- **`icon`** replaces the header icon of the `variant` with any icon slug; colors and label still follow the `variant`. When not set or empty, the icon follows the `variant`. The header icon is decorative: the label carries the meaning.\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-usage>` 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#### Default Informational Note\n\nThe simplest form. Omit `variant` to get the `info` default - a neutral, blue-tinted container that draws attention to a usage note without implying correctness or incorrectness.\n\n```html\n<mds-usage>\n  <mds-text>\n    Utilizzare sempre il colore primario del tema per le azioni principali.\n  </mds-text>\n</mds-usage>\n```\n\n#### Recommended Pattern (`variant=\"do\"`)\n\nUse `variant=\"do\"` to mark a component usage or design pattern as explicitly recommended. The container adopts success styling and the header reads the variant label.\n\n```html\n<mds-usage variant=\"do\">\n  <mds-button label=\"Salva\" variant=\"primary\" tone=\"strong\"></mds-button>\n</mds-usage>\n```\n\n#### Discouraged Pattern (`variant=\"dont\"`)\n\nUse `variant=\"dont\"` to mark a usage as explicitly forbidden or inadvisable. The container adopts error styling.\n\n```html\n<mds-usage variant=\"dont\">\n  <button style=\"background: blue; color: white;\">Salva</button>\n</mds-usage>\n```\n\n#### Cautionary Note (`variant=\"warn\"`)\n\nUse `variant=\"warn\"` when a pattern is not forbidden but requires care - for example when a prop combination is valid but has side effects, or when a rare edge case exists. The container adopts warning styling.\n\n```html\n<mds-usage variant=\"warn\">\n  <mds-text>\n    Impostare type=\"button\" su ogni pulsante all'interno di un form\n    per evitare invii accidentali.\n  </mds-text>\n</mds-usage>\n```\n\n#### Custom Header Label via `alias`\n\nWhen the auto-generated, localized header (\"Consentito\", \"Non consentito\", etc.) is not specific enough for the context, pass `alias` to replace it with a custom string. The locale dictionary is bypassed entirely.\n\n```html\n<mds-usage variant=\"do\" alias=\"Struttura consigliata\">\n  <mds-text>Usare mds-card con header, content e footer separati.</mds-text>\n</mds-usage>\n\n<mds-usage variant=\"dont\" alias=\"Struttura da evitare\">\n  <mds-text>Non annidare mds-card all'interno di un'altra mds-card.</mds-text>\n</mds-usage>\n```\n\n#### Custom Header Icon via `icon`\n\nEach `variant` has its own header icon. When a custom `alias` names a more specific category, pass `icon` with a slug that illustrates it; the `variant` still drives the colors and the label fallback. Keep the icon coherent with the `variant`.\n\n```html\n<mds-usage variant=\"do\" alias=\"Struttura consigliata\" icon=\"mi/baseline/account-tree\">\n  <mds-text>Usare mds-card con header, content e footer separati.</mds-text>\n</mds-usage>\n```\n\n#### Side-by-Side Do / Dont Pair\n\nPair a `do` block with a `dont` block to illustrate a correct and an incorrect approach in the same documentation section. No extra wrapper is needed - use a CSS grid or flex container.\n\n```html\n<div style=\"display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;\">\n  <mds-usage variant=\"do\">\n    <mds-button label=\"Conferma\" variant=\"primary\" tone=\"strong\"></mds-button>\n  </mds-usage>\n\n  <mds-usage variant=\"dont\">\n    <mds-button label=\"Conferma\" tone=\"strong\" style=\"--mds-button-background: green;\"></mds-button>\n  </mds-usage>\n</div>\n```\n\n#### Rich Slotted Content\n\nThe default slot accepts any HTML or Magma components. Use this to annotate a fully composed UI fragment rather than a single element.\n\n```html\n<mds-usage variant=\"do\" alias=\"Composizione corretta di mds-card\">\n  <mds-card>\n    <mds-card-header slot=\"header\">\n      <mds-text typography=\"h5\">Titolo scheda</mds-text>\n    </mds-card-header>\n    <mds-card-content slot=\"content\">\n      <mds-text>Contenuto principale della scheda.</mds-text>\n    </mds-card-content>\n    <mds-card-footer slot=\"footer\">\n      <mds-button label=\"Azione\" variant=\"primary\"></mds-button>\n    </mds-card-footer>\n  </mds-card>\n</mds-usage>\n```\n\n#### Styling Customization\n\n`mds-usage` has no public CSS custom property: its border and header colours follow the `variant` (`do`, `dont`, `info`, `warn`). When an annotation needs other colours, style the documented `header`, `icon` and `label` parts, and use the semantic color roles via `rgb(var(--magma-<role>))` to keep dark mode working.\n\n```css\n.docs-callout mds-usage::part(header) {\n  background-color: rgb(var(--magma-accent-ai-emphasis));\n}\n.docs-callout mds-usage::part(icon) {\n  fill: rgb(var(--magma-accent-ai-on-emphasis));\n}\n.docs-callout mds-usage::part(label) {\n  color: rgb(var(--magma-accent-ai-on-emphasis));\n}\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-usage>`. 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 Use `variant` as the Shared Tone/Variant Ladder\n\n`<mds-usage>` does not use the system-wide `variant` ladder (`primary`, `secondary`, `error`, etc.). Its `variant` prop is component-specific (`do`, `dont`, `info`, `warn`). Passing a system variant silently falls back to the base info-like styling and the info icon, with an empty header label (the locale has no entry for it).\n\n```html\n<!-- INCORRECT -->\n<mds-usage variant=\"error\">\n  <mds-text>Non consentito.</mds-text>\n</mds-usage>\n\n<!-- CORRECT -->\n<mds-usage variant=\"dont\">\n  <mds-text>Non consentito.</mds-text>\n</mds-usage>\n```\n\n#### Do Not Use an `icon` That Contradicts the `variant`\n\n`icon` replaces only the glyph: colors and label still follow the `variant`. An icon that means the opposite (a tick on a `dont` block, a cross on a `do` block) sends two conflicting signals. To change the meaning, change the `variant`; use `icon` only to make the same meaning more specific.\n\n```html\n<!-- INCORRECT -->\n<mds-usage variant=\"dont\" icon=\"mi/baseline/check-circle\">\n  <mds-text>Non annidare mds-card all'interno di un'altra mds-card.</mds-text>\n</mds-usage>\n\n<!-- CORRECT -->\n<mds-usage variant=\"dont\">\n  <mds-text>Non annidare mds-card all'interno di un'altra mds-card.</mds-text>\n</mds-usage>\n```\n\n#### Do Not Omit the Slot Content\n\n`<mds-usage>` renders a labeled container; without slotted content the block displays only the colored header strip with no body - producing a visually broken annotation. Always provide meaningful content in the default slot.\n\n```html\n<!-- INCORRECT -->\n<mds-usage variant=\"do\"></mds-usage>\n\n<!-- CORRECT -->\n<mds-usage variant=\"do\">\n  <mds-text>Usare sempre il colore del tema per i pulsanti primari.</mds-text>\n</mds-usage>\n```\n\n#### Do Not Put the Label in the Default Slot\n\nThe default slot is the body of the block. Placing a heading or label string there makes it look like body text, not a header. Use the `alias` prop to supply a custom header label.\n\n```html\n<!-- INCORRECT -->\n<mds-usage variant=\"do\">\n  Struttura consigliata\n</mds-usage>\n\n<!-- CORRECT -->\n<mds-usage variant=\"do\" alias=\"Struttura consigliata\">\n  <mds-text>Comporre mds-card con i suoi sotto-componenti dedicati.</mds-text>\n</mds-usage>\n```\n\n#### Do Not Pierce the Shadow DOM to Restyle the Header\n\n`::part(header)`, `::part(icon)`, and `::part(label)` are the only documented extension points for shadow internals. Targeting undocumented class names or using `>>>` couples code to implementation details that may change. `mds-usage` has no public CSS custom property: for color overrides, pick the `variant` or style these parts instead.\n\n```css\n/* INCORRECT */\nmds-usage >>> .header {\n  background: rgb(var(--magma-accent-ai-emphasis));\n}\n\n/* CORRECT */\nmds-usage::part(header) {\n  background-color: rgb(var(--magma-accent-ai-emphasis));\n}\nmds-usage::part(label) {\n  color: rgb(var(--magma-accent-ai-on-emphasis));\n}\n```\n\n#### Do Not Use `<mds-usage>` as a General-Purpose Card\n\n`<mds-usage>` is a documentation/Storybook annotation primitive - it is not a card, callout, or alert for production UIs. For in-app status messages use [`mds-banner`](../mds-banner/AGENTS.md), [`mds-note`](../mds-note/AGENTS.md), or [`mds-toast`](../mds-toast/AGENTS.md).\n\n```html\n<!-- INCORRECT - using mds-usage as a production alert -->\n<mds-usage variant=\"warn\">\n  <mds-text>La sessione sta per scadere.</mds-text>\n</mds-usage>\n\n<!-- CORRECT - use the appropriate production component -->\n<mds-banner variant=\"warning\" tone=\"weak\">La sessione sta per scadere.</mds-banner>\n```\n"
      },
      "props": [
        {
          "name": "alias",
          "type": "string | undefined",
          "complexType": {
            "original": "string",
            "resolved": "string | undefined",
            "references": {}
          },
          "mutable": false,
          "attr": "alias",
          "reflectToAttr": false,
          "docs": "Specifies the alias of the usage phrase on the top of the component",
          "docsTags": [],
          "values": [
            {
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "icon",
          "type": "string | undefined",
          "complexType": {
            "original": "string",
            "resolved": "string | undefined",
            "references": {}
          },
          "mutable": false,
          "attr": "icon",
          "reflectToAttr": false,
          "docs": "Specifies the icon displayed in the header; when not set or empty, the icon follows the `variant`",
          "docsTags": [],
          "values": [
            {
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "variant",
          "type": "\"do\" | \"dont\" | \"info\" | \"warn\"",
          "complexType": {
            "original": "UsageType",
            "resolved": "\"do\" | \"dont\" | \"info\" | \"warn\"",
            "references": {
              "UsageType": {
                "location": "import",
                "path": "./meta/types",
                "id": "src/components/mds-usage/meta/types.ts::UsageType",
                "referenceLocation": "UsageType"
              }
            }
          },
          "mutable": false,
          "attr": "variant",
          "reflectToAttr": true,
          "docs": "Specifies the guidance category of the content, which drives colors, header label and icon",
          "docsTags": [
            {
              "name": "default",
              "text": "'info'"
            }
          ],
          "default": "'info'",
          "values": [
            {
              "value": "do",
              "type": "string"
            },
            {
              "value": "dont",
              "type": "string"
            },
            {
              "value": "info",
              "type": "string"
            },
            {
              "value": "warn",
              "type": "string"
            }
          ],
          "optional": false,
          "required": false,
          "getter": false,
          "setter": false
        }
      ],
      "methods": [],
      "events": [],
      "listeners": [],
      "styles": [
        {
          "name": "--mds-usage-border-color",
          "annotation": "prop",
          "docs": "The border-color applied to the usage container or indicator.",
          "visibility": "internal"
        },
        {
          "name": "--mds-usage-header-background",
          "annotation": "prop",
          "docs": "The background-color of the usage header.",
          "visibility": "internal"
        },
        {
          "name": "--mds-usage-header-color",
          "annotation": "prop",
          "docs": "The text/icon color of the usage header.",
          "visibility": "internal"
        }
      ],
      "slots": [
        {
          "name": "",
          "docs": "Add `text string`, `HTML elements` or `components` to this slot."
        }
      ],
      "parts": [
        {
          "name": "header",
          "docs": "The header that holds the `icon` and the `label`"
        },
        {
          "name": "icon",
          "docs": "The icon of the header, the one of `variant` unless `icon` is set"
        },
        {
          "name": "label",
          "docs": "The label of the header, the name of `variant` unless `alias` is set"
        }
      ],
      "states": [],
      "dependents": [],
      "dependencies": [
        "mds-icon",
        "mds-text"
      ],
      "dependencyGraph": {
        "mds-usage": [
          "mds-icon",
          "mds-text"
        ]
      },
      "storybook": "ui-usage--docs"
    }
  ]
}
