{
  "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-kpi-item/mds-kpi-item.tsx",
      "encapsulation": "shadow",
      "tag": "mds-kpi-item",
      "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": "part",
          "text": "content - Selects the label and description wrapper element"
        },
        {
          "name": "part",
          "text": "icon - Selects the icon element"
        },
        {
          "name": "part",
          "text": "icon-container - Selects the icon wrapper element"
        },
        {
          "name": "parent",
          "text": "mds-kpi"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-kpi-item>` web component is a compound child that represents a single key-performance-indicator entry - a prominent numeric `label` with an optional `description` and `icon` - inside its parent container [`<mds-kpi>`](../mds-kpi/AGENTS.md). It carries no native HTML primitive of its own; it is a presentational list row that `<mds-kpi>` exposes as a list.\n\n#### Semantic Behavior\n\n- **Compound constraint**: Must be placed as a direct default-slot child of [`<mds-kpi>`](../mds-kpi/AGENTS.md); it is not used standalone, and the parent's list semantics only make sense when its children are `mds-kpi-item` elements (do not mix in other child types).\n- **Accessible name**: Each item is announced as one list entry, with its spoken text consolidated as `\"{label}: {description}\"`, leaving out the one that is missing; an `aria-label` on the host replaces it and stays.\n- **Scroll-triggered animation**: When `threshold` is greater than `0`, the `label`/`description` reveal with the `yugop` text animation once the item scrolls into the viewport. With `threshold === 0` (the default) the text is rendered immediately with no animation.\n- **Conditional rendering**: The icon, value, and description each render only when their respective prop is provided, so an item can show any subset of icon, value, and caption.\n\n#### Properties & Visual Configurations\n\n- **`threshold`**: Controls the reveal-on-scroll behavior. Leave at `0` for static KPIs that should be visible immediately; set a value between `0` and `1` (the fraction of the element that must enter the viewport) to defer the scramble-in animation until the item is scrolled into view - useful for KPI strips lower on a page.\n- **`label`** holds the headline figure (rendered as `h2` typography) and **`description`** the supporting caption (rendered as `label` typography); together they form the item's spoken accessible name, so prefer concise, self-explanatory values.\n- **`icon`** takes an `mds-icon` name and adds a leading visual marker above the figure; omit it for text-only KPIs.\n\n`<mds-kpi-item>` has no public CSS custom property of its own: the animation pacing comes from the public `--mds-kpi-text-animation-speed` and `--mds-kpi-text-animation-placeholder-char` of the parent [`<mds-kpi>`](../mds-kpi/AGENTS.md), and colors are tuned through the shadow parts documented in [`AGENTS.md`](AGENTS.md) (`icon-container`, `icon`, `content`).\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-kpi-item>` 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 KPI Entry with Label and Description\n\nThe canonical form: a headline figure in `label` and a supporting caption in `description`, placed inside [`<mds-kpi>`](../mds-kpi/AGENTS.md). Both props feed the item's accessible spoken name automatically.\n\n```html\n<mds-kpi>\n  <mds-kpi-item\n    label=\"1.240\"\n    description=\"Pratiche elaborate\"\n  ></mds-kpi-item>\n</mds-kpi>\n```\n\n#### KPI Entry with an Icon\n\nAdd `icon` to display a visual marker above the figure. Use an icon slug from the Magma icon library - no `.svg` extension.\n\n```html\n<mds-kpi>\n  <mds-kpi-item\n    label=\"98%\"\n    description=\"Soddisfazione clienti\"\n    icon=\"mi/baseline/thumb-up\"\n  ></mds-kpi-item>\n</mds-kpi>\n```\n\n#### Multiple KPI Items in a Panel\n\nGroup related metrics by placing several `<mds-kpi-item>` elements as direct children of `<mds-kpi>`. The parent sets up the `list` role; each item registers as a `listitem`.\n\n```html\n<mds-kpi>\n  <mds-kpi-item label=\"3.500\" description=\"Utenti attivi\" icon=\"mi/baseline/group\"></mds-kpi-item>\n  <mds-kpi-item label=\"128\" description=\"Servizi erogati\" icon=\"mi/baseline/work\"></mds-kpi-item>\n  <mds-kpi-item label=\"99,9%\" description=\"Disponibilita del sistema\" icon=\"mi/baseline/check-circle\"></mds-kpi-item>\n</mds-kpi>\n```\n\n#### Scroll-Triggered Reveal Animation\n\nSet `threshold` to a value between `0` and `1` to defer the yugop text animation until the item enters the viewport. A value of `0.5` means at least 50 % of the item must be visible before the animation starts. Use this for KPI strips placed lower on a landing page.\n\n```html\n<mds-kpi>\n  <mds-kpi-item\n    label=\"45.000\"\n    description=\"Documenti archiviati\"\n    icon=\"mi/baseline/folder\"\n    threshold=\"0.5\"\n  ></mds-kpi-item>\n</mds-kpi>\n```\n\n#### Label-Only KPI (No Description)\n\nOmit `description` only when the figure is self-explanatory. The accessible name is then the figure alone (`2026`); ensure the surrounding context provides enough meaning.\n\n```html\n<mds-kpi>\n  <mds-kpi-item label=\"2026\"></mds-kpi-item>\n</mds-kpi>\n```\n\n#### Icon-Only Visual Accent (No Numeric Value)\n\nOmit `label` and `description` to display only the icon as a decorative tile. In this case the item has no name - add an explicit `aria-label` on the host to describe the tile to screen-reader users. The component keeps it at first render but writes its own name back at its next re-render (for example when a user preference changes).\n\n```html\n<mds-kpi>\n  <mds-kpi-item\n    icon=\"mi/baseline/star\"\n    aria-label=\"Valutazione eccellente\"\n  ></mds-kpi-item>\n</mds-kpi>\n```\n\n#### Styling Customization\n\n`<mds-kpi-item>` has no public CSS custom property. Tune the animation timing on the parent with the public `--mds-kpi-text-animation-*` properties of [`<mds-kpi>`](../mds-kpi/AGENTS.md), which every item inherits; icon color and text-area background go through the shadow parts below.\n\n```css\n.highlight-kpi mds-kpi {\n  --mds-kpi-text-animation-speed: 0.08;\n  --mds-kpi-text-animation-placeholder-char: \"0\";\n}\n```\n\n#### Targeting Shadow Parts for Deep Customization\n\nStyle the item through its three documented shadow parts: `icon-container`, `icon`, and `content`. Use the semantic color roles via `rgb(var(--magma-<role>))` ([`agents/color.md`](../../../../agents/color.md)) so dark mode keeps working.\n\n```css\nmds-kpi-item::part(icon-container) {\n  background-color: rgb(var(--magma-accent-surface));\n  border-radius: var(--magma-radius-2xl);\n}\n\nmds-kpi-item::part(icon) {\n  fill: rgb(var(--magma-accent-fg));\n}\n\nmds-kpi-item::part(content) {\n  background-color: rgb(var(--magma-surface-overlay));\n}\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-kpi-item>`. 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 `mds-kpi-item` Outside `mds-kpi`\n\n`<mds-kpi-item>` is a compound child designed to be a direct slot child of [`<mds-kpi>`](../mds-kpi/AGENTS.md). Using it standalone strips the list semantics that `<mds-kpi>` provides and breaks the expected visual layout.\n\n```html\n<!-- INCORRECT -->\n<mds-kpi-item label=\"1.240\" description=\"Pratiche elaborate\"></mds-kpi-item>\n\n<!-- CORRECT -->\n<mds-kpi>\n  <mds-kpi-item label=\"1.240\" description=\"Pratiche elaborate\"></mds-kpi-item>\n</mds-kpi>\n```\n\n#### Do Not Slot HTML Content for the Label or Description\n\n`<mds-kpi-item>` has no default slot - all text content is driven by the `label` and `description` props. Slotting child nodes produces no output because the component renders nothing from its slot.\n\n```html\n<!-- INCORRECT -->\n<mds-kpi>\n  <mds-kpi-item>\n    <span>1.240</span>\n    <small>Pratiche elaborate</small>\n  </mds-kpi-item>\n</mds-kpi>\n\n<!-- CORRECT -->\n<mds-kpi>\n  <mds-kpi-item label=\"1.240\" description=\"Pratiche elaborate\"></mds-kpi-item>\n</mds-kpi>\n```\n\n#### Do Not Slot `<mds-icon>` to Add an Icon\n\nThe `icon` prop passes the slug to the internal `<mds-icon>` instance. Slotting an `<mds-icon>` directly has no effect because the component has no named slot for icons.\n\n```html\n<!-- INCORRECT -->\n<mds-kpi>\n  <mds-kpi-item label=\"98%\" description=\"Soddisfazione clienti\">\n    <mds-icon name=\"mi/baseline/thumb-up\"></mds-icon>\n  </mds-kpi-item>\n</mds-kpi>\n\n<!-- CORRECT -->\n<mds-kpi>\n  <mds-kpi-item\n    label=\"98%\"\n    description=\"Soddisfazione clienti\"\n    icon=\"mi/baseline/thumb-up\"\n  ></mds-kpi-item>\n</mds-kpi>\n```\n\n#### Do Not Set `threshold=\"0\"` to Disable Animation - Omit It\n\n`threshold` defaults to `0`, so setting it explicitly to `\"0\"` is a no-op. More importantly, `threshold=\"false\"` or `threshold=\"none\"` is parsed to `NaN`, which the IntersectionObserver rejects with an error at runtime.\n\n```html\n<!-- INCORRECT -->\n<mds-kpi-item label=\"3.500\" description=\"Utenti\" threshold=\"false\"></mds-kpi-item>\n<mds-kpi-item label=\"3.500\" description=\"Utenti\" threshold=\"none\"></mds-kpi-item>\n\n<!-- CORRECT - omit threshold entirely for no animation (defaults to 0) -->\n<mds-kpi-item label=\"3.500\" description=\"Utenti\"></mds-kpi-item>\n```\n\n#### Do Not Pierce Shadow DOM to Style Internal Elements\n\nThe supported customization surface is the three documented shadow parts (`icon-container`, `icon`, `content`), plus the public `--mds-kpi-text-animation-*` properties of the parent `<mds-kpi>`. Reaching inside the shadow DOM via `>>>` or undocumented class names couples your code to the implementation and will break on minor releases.\n\n```css\n/* INCORRECT */\nmds-kpi-item >>> .info {\n  background: white;\n}\nmds-kpi-item >>> .value {\n  font-size: 3rem;\n}\n\n/* CORRECT */\nmds-kpi-item::part(content) {\n  background-color: rgb(var(--magma-surface-overlay));\n  padding: calc(var(--spacing) * 600);\n}\n```\n\n#### Do Not Leave Icon-Only Items Without an Accessible Name\n\nWhen both `label` and `description` are omitted the item has no accessible name at all. Supply an explicit `aria-label` on the host when the item carries no text props (the component keeps it at first render, but writes its own name back at its next re-render).\n\n```html\n<!-- INCORRECT -->\n<mds-kpi>\n  <mds-kpi-item icon=\"mi/baseline/star\"></mds-kpi-item>\n</mds-kpi>\n\n<!-- CORRECT -->\n<mds-kpi>\n  <mds-kpi-item\n    icon=\"mi/baseline/star\"\n    aria-label=\"Valutazione eccellente\"\n  ></mds-kpi-item>\n</mds-kpi>\n```\n"
      },
      "props": [
        {
          "name": "description",
          "type": "string | undefined",
          "complexType": {
            "original": "string",
            "resolved": "string | undefined",
            "references": {}
          },
          "mutable": false,
          "attr": "description",
          "reflectToAttr": false,
          "docs": "Specifies the description under the value in the KPI element",
          "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 on the top of the KPI element",
          "docsTags": [],
          "values": [
            {
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "label",
          "type": "string | undefined",
          "complexType": {
            "original": "string",
            "resolved": "string | undefined",
            "references": {}
          },
          "mutable": false,
          "attr": "label",
          "reflectToAttr": false,
          "docs": "Specifies the number to be displayed in the KPI element",
          "docsTags": [],
          "values": [
            {
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "threshold",
          "type": "number | undefined",
          "complexType": {
            "original": "number",
            "resolved": "number | undefined",
            "references": {}
          },
          "mutable": false,
          "attr": "threshold",
          "reflectToAttr": false,
          "docs": "Specifies the page threshold which starts the text animation",
          "docsTags": [
            {
              "name": "default",
              "text": "0"
            }
          ],
          "default": "0",
          "values": [
            {
              "type": "number"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        }
      ],
      "methods": [],
      "events": [],
      "listeners": [],
      "styles": [
        {
          "name": "--mds-kpi-item-icon-color",
          "annotation": "prop",
          "docs": "Set the fill color of the icon element",
          "visibility": "internal"
        },
        {
          "name": "--mds-kpi-item-info-background",
          "annotation": "prop",
          "docs": "Set the `background-color` of the text area element",
          "visibility": "internal"
        },
        {
          "name": "--mds-kpi-item-text-animation-placeholder-char",
          "annotation": "prop",
          "docs": "Sets the animation placeholder char of the text",
          "visibility": "internal"
        },
        {
          "name": "--mds-kpi-item-text-animation-speed",
          "annotation": "prop",
          "docs": "Sets the animation speed of the text",
          "visibility": "internal"
        }
      ],
      "slots": [],
      "parts": [
        {
          "name": "content",
          "docs": "Selects the label and description wrapper element"
        },
        {
          "name": "icon",
          "docs": "Selects the icon element"
        },
        {
          "name": "icon-container",
          "docs": "Selects the icon wrapper element"
        }
      ],
      "states": [],
      "dependents": [],
      "dependencies": [
        "mds-icon",
        "mds-text"
      ],
      "dependencyGraph": {
        "mds-kpi-item": [
          "mds-icon",
          "mds-text"
        ]
      },
      "storybook": "ui-kpi-kpi-item--docs"
    }
  ]
}
