{
  "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-table-body/mds-table-body.tsx",
      "encapsulation": "shadow",
      "tag": "mds-table-body",
      "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": "- Put `mds-table-row` element/s."
        },
        {
          "name": "parent",
          "text": "mds-table"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-table-body>` web component is the row-group container of the Magma Design System tabular data system, used inside [`<mds-table>`](../mds-table/AGENTS.md). It is the equivalent of the native HTML `<tbody>`, grouping the data `mds-table-row` elements and relaying the parent table's interaction and selection styling to those rows.\n\n#### Semantic Behavior\n\n- **Compound child**: Must be a direct slot child of `<mds-table>` and hold only `mds-table-row` elements; it is not used standalone nor interleaved with `mds-table-header` / `mds-table-footer` content.\n- **Parent-driven state**: Both `interactive` and `selection` are set by the parent table, so consumers normally do not toggle them by hand.\n- **Live rows**: Rows added or removed at runtime are detected and re-wired with the table's interactive/selectable state.\n- **Hover relay**: When `interactive` is set, hovering the body highlights its rows.\n- **Last-row border trimming**: The last `mds-table-body` in a table clears the bottom border of its final row, so the final row does not double the table's own outer border.\n\n#### Properties & Visual Configurations\n\nThis component exposes only two boolean flags, both intended to be managed by the parent `<mds-table>` rather than set directly:\n\n- **`interactive`** enables the mouseover row-highlight styling for the group; it mirrors the table's own `interactive` prop.\n- **`selection`** switches the body's default background to its alternate tone to signal that an active selection exists; the parent sets it true while at least one row is selected.\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-table-body>` 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 Table Body with Data Rows\n\nThe canonical form. Place `<mds-table-body>` as a direct slot child of [`<mds-table>`](../mds-table/AGENTS.md) and populate it with [`<mds-table-row>`](../mds-table-row/AGENTS.md) elements. The parent table wires `interactive` and `selection` automatically - do not set them by hand in most cases.\n\n```html\n<mds-table>\n  <mds-table-header>\n    <mds-table-header-cell label=\"Nome\"></mds-table-header-cell>\n    <mds-table-header-cell label=\"Ruolo\"></mds-table-header-cell>\n    <mds-table-header-cell label=\"Stato\"></mds-table-header-cell>\n  </mds-table-header>\n  <mds-table-body>\n    <mds-table-row>\n      <mds-table-cell>Marco Rossi</mds-table-cell>\n      <mds-table-cell>Amministratore</mds-table-cell>\n      <mds-table-cell>Attivo</mds-table-cell>\n    </mds-table-row>\n    <mds-table-row>\n      <mds-table-cell>Laura Bianchi</mds-table-cell>\n      <mds-table-cell>Operatore</mds-table-cell>\n      <mds-table-cell>Inattivo</mds-table-cell>\n    </mds-table-row>\n  </mds-table-body>\n</mds-table>\n```\n\n#### Interactive Table (Row Hover Highlight)\n\nSet `interactive` on the parent `<mds-table>`. The table propagates the flag down to `<mds-table-body>` and every `<mds-table-row>`, applying the hover background without any extra wiring in the body markup.\n\n```html\n<mds-table interactive>\n  <mds-table-header>\n    <mds-table-header-cell label=\"Documento\"></mds-table-header-cell>\n    <mds-table-header-cell label=\"Data\"></mds-table-header-cell>\n  </mds-table-header>\n  <mds-table-body>\n    <mds-table-row>\n      <mds-table-cell>Delibera n. 42</mds-table-cell>\n      <mds-table-cell>12/05/2025</mds-table-cell>\n    </mds-table-row>\n    <mds-table-row>\n      <mds-table-cell>Determina n. 07</mds-table-cell>\n      <mds-table-cell>03/06/2025</mds-table-cell>\n    </mds-table-row>\n  </mds-table-body>\n</mds-table>\n```\n\n#### Selectable Table (Row Checkboxes)\n\nSet `selectable` on `<mds-table>`. The table equips every row with a checkbox and manages the `selection` state on `<mds-table-body>` - switching the body background to the alternate tone while at least one row is checked. Listen to `mdsTableSelectionChange` on the table for the current selection.\n\n```html\n<mds-table selectable id=\"tabella-utenti\">\n  <mds-table-header>\n    <mds-table-header-cell label=\"Utente\"></mds-table-header-cell>\n    <mds-table-header-cell label=\"Reparto\"></mds-table-header-cell>\n  </mds-table-header>\n  <mds-table-body>\n    <mds-table-row value=\"u1\">\n      <mds-table-cell>Giulia Verdi</mds-table-cell>\n      <mds-table-cell>Risorse Umane</mds-table-cell>\n    </mds-table-row>\n    <mds-table-row value=\"u2\">\n      <mds-table-cell>Andrea Neri</mds-table-cell>\n      <mds-table-cell>Contabilita</mds-table-cell>\n    </mds-table-row>\n  </mds-table-body>\n</mds-table>\n\n<script>\n  document.querySelector('#tabella-utenti').addEventListener('mdsTableSelectionChange', (e) => {\n    console.log('Righe selezionate:', e.detail.rows);\n  });\n</script>\n```\n\n#### Selectable Table with Batch Actions\n\nWhen `selectable` is set and at least one `<mds-button>` is assigned to the `batch-action` slot on `<mds-table>`, the table renders a batch-action bar whenever rows are selected. The `<mds-table-body>` does not require any extra attributes for this.\n\n```html\n<mds-table selectable>\n  <mds-button slot=\"batch-action\" label=\"Archivia selezionati\" variant=\"primary\" tone=\"strong\"></mds-button>\n  <mds-button slot=\"batch-action\" label=\"Elimina selezionati\" variant=\"error\" tone=\"text\"></mds-button>\n  <mds-table-header>\n    <mds-table-header-cell label=\"Pratica\"></mds-table-header-cell>\n    <mds-table-header-cell label=\"Richiedente\"></mds-table-header-cell>\n  </mds-table-header>\n  <mds-table-body>\n    <mds-table-row value=\"p1\">\n      <mds-table-cell>SUAP-2025-001</mds-table-cell>\n      <mds-table-cell>Mario Conti</mds-table-cell>\n    </mds-table-row>\n    <mds-table-row value=\"p2\">\n      <mds-table-cell>SUAP-2025-002</mds-table-cell>\n      <mds-table-cell>Silvia Ricci</mds-table-cell>\n    </mds-table-row>\n  </mds-table-body>\n</mds-table>\n```\n\n#### Table with Header, Body, and Footer\n\nUse [`<mds-table-header>`](../mds-table-header/AGENTS.md), `<mds-table-body>`, and [`<mds-table-footer>`](../mds-table-footer/AGENTS.md) together inside `<mds-table>`. The body's last-row border is automatically trimmed where it meets the footer, so no manual border removal is needed.\n\n```html\n<mds-table>\n  <mds-table-header>\n    <mds-table-header-cell label=\"Voce\"></mds-table-header-cell>\n    <mds-table-header-cell label=\"Importo\"></mds-table-header-cell>\n  </mds-table-header>\n  <mds-table-body>\n    <mds-table-row>\n      <mds-table-cell>Compenso servizio</mds-table-cell>\n      <mds-table-cell>1.200,00 EUR</mds-table-cell>\n    </mds-table-row>\n    <mds-table-row>\n      <mds-table-cell>Rimborso spese</mds-table-cell>\n      <mds-table-cell>85,50 EUR</mds-table-cell>\n    </mds-table-row>\n  </mds-table-body>\n  <mds-table-footer>\n    <mds-table-cell>Totale</mds-table-cell>\n    <mds-table-cell>1.285,50 EUR</mds-table-cell>\n  </mds-table-footer>\n</mds-table>\n```\n\n#### Styling Customization via CSS Custom Properties\n\nOverride the two public `--mds-table-body-*` CSS custom properties, the default background and text colour of the rows, on the host or a parent selector. The hover highlight and the alternate tone shown during a selection follow the `interactive` and `selection` states. Use the semantic color roles wrapped in `rgb(var(--magma-<role>))` so dark mode and high-contrast modes stay consistent.\n\n```css\n.tabella-evidenziata mds-table-body {\n  --mds-table-body-background: rgb(var(--magma-surface-raised));\n  --mds-table-body-color: rgb(var(--magma-text-default));\n}\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-table-body>`. 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-table-body>` Outside `<mds-table>`\n\n`<mds-table-body>` is a compound child and relies on the parent table for `display: table-row-group` context and for receiving the `interactive` / `selection` flags. Used standalone, layout and state wiring both break.\n\n```html\n<!-- INCORRECT -->\n<mds-table-body>\n  <mds-table-row>\n    <mds-table-cell>Mario Rossi</mds-table-cell>\n  </mds-table-row>\n</mds-table-body>\n\n<!-- CORRECT -->\n<mds-table>\n  <mds-table-header>\n    <mds-table-header-cell label=\"Nome\"></mds-table-header-cell>\n  </mds-table-header>\n  <mds-table-body>\n    <mds-table-row>\n      <mds-table-cell>Mario Rossi</mds-table-cell>\n    </mds-table-row>\n  </mds-table-body>\n</mds-table>\n```\n\n#### Do Not Put Raw `<tr>` / `<td>` Inside `<mds-table-body>`\n\nThe component's slot accepts only [`<mds-table-row>`](../mds-table-row/AGENTS.md) elements. Raw `<tr>` elements are not styled by the design-system tokens, do not receive hover or selection state, and skip accessibility roles.\n\n```html\n<!-- INCORRECT -->\n<mds-table>\n  <mds-table-body>\n    <tr>\n      <td>Laura Bianchi</td>\n      <td>Operatore</td>\n    </tr>\n  </mds-table-body>\n</mds-table>\n\n<!-- CORRECT -->\n<mds-table>\n  <mds-table-body>\n    <mds-table-row>\n      <mds-table-cell>Laura Bianchi</mds-table-cell>\n      <mds-table-cell>Operatore</mds-table-cell>\n    </mds-table-row>\n  </mds-table-body>\n</mds-table>\n```\n\n#### Do Not Set `interactive` or `selection` Directly on the Body\n\nBoth flags are managed by the parent `<mds-table>`. Setting them by hand on `<mds-table-body>` will be overwritten the next time the table propagates its own state - and it creates a mismatch between the body state and the individual row states, which are also wired by the table.\n\n```html\n<!-- INCORRECT -->\n<mds-table>\n  <mds-table-body interactive selection>\n    <mds-table-row>\n      <mds-table-cell>Giulia Verdi</mds-table-cell>\n    </mds-table-row>\n  </mds-table-body>\n</mds-table>\n\n<!-- CORRECT -->\n<mds-table interactive selectable>\n  <mds-table-body>\n    <mds-table-row>\n      <mds-table-cell>Giulia Verdi</mds-table-cell>\n    </mds-table-row>\n  </mds-table-body>\n</mds-table>\n```\n\n#### Do Not Set Boolean Props as Strings\n\nStencil reads the exact string `\"false\"` as `false`, but `interactive=\"false\"` and `selection=\"false\"` leave the attribute on the element, and the body styles its hover and selection states on the attribute (`:host([interactive]:hover)`, `:host([selection])`), so they still apply. Remove the attribute to turn it off; never assign the string `\"false\"`.\n\n```html\n<!-- INCORRECT -->\n<mds-table-body interactive=\"false\" selection=\"false\">\n  ...\n</mds-table-body>\n\n<!-- CORRECT (attribute absent = prop is undefined / false) -->\n<mds-table-body>\n  ...\n</mds-table-body>\n```\n\n#### Do Not Customize via Undocumented Internal Selectors\n\nThe supported customization surface is the two public `--mds-table-body-*` CSS custom properties, `--mds-table-body-background` and `--mds-table-body-color`. Piercing the shadow DOM or targeting undocumented internal classes couples your code to the implementation and breaks on minor releases.\n\n```css\n/* INCORRECT */\nmds-table-body >>> tr {\n  background: lightyellow;\n}\n\n/* CORRECT */\nmds-table-body {\n  --mds-table-body-background: rgb(var(--magma-surface-muted));\n}\n```\n"
      },
      "props": [
        {
          "name": "interactive",
          "type": "boolean | undefined",
          "complexType": {
            "original": "boolean",
            "resolved": "boolean | undefined",
            "references": {}
          },
          "mutable": false,
          "attr": "interactive",
          "reflectToAttr": true,
          "docs": "Specifies whether the rows react to user interaction (hover/focus).",
          "docsTags": [],
          "values": [
            {
              "type": "boolean"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "selection",
          "type": "boolean | undefined",
          "complexType": {
            "original": "boolean",
            "resolved": "boolean | undefined",
            "references": {}
          },
          "mutable": false,
          "attr": "selection",
          "reflectToAttr": true,
          "docs": "Enables the selection column for the rows in this table body.",
          "docsTags": [],
          "values": [
            {
              "type": "boolean"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        }
      ],
      "methods": [],
      "events": [],
      "listeners": [],
      "styles": [
        {
          "name": "--mds-table-body-background",
          "annotation": "prop",
          "docs": "Default background color of table body rows.",
          "visibility": "public"
        },
        {
          "name": "--mds-table-body-background-alt",
          "annotation": "prop",
          "docs": "Alternate background color for table body rows.",
          "visibility": "internal"
        },
        {
          "name": "--mds-table-body-background-hover",
          "annotation": "prop",
          "docs": "Background color for table body rows on hover.",
          "visibility": "internal"
        },
        {
          "name": "--mds-table-body-color",
          "annotation": "prop",
          "docs": "Default text color for table body rows.",
          "visibility": "public"
        },
        {
          "name": "--mds-table-body-color-alt",
          "annotation": "prop",
          "docs": "Text color for alternate table body rows.",
          "visibility": "internal"
        }
      ],
      "slots": [
        {
          "name": "",
          "docs": "Put `mds-table-row` element/s."
        }
      ],
      "parts": [],
      "states": [],
      "dependents": [],
      "dependencies": [],
      "dependencyGraph": {},
      "storybook": "layout-table-body--docs"
    }
  ]
}
