An open source design system that's fully customizable and agent ready
TypeScript
docs(spec): TableCell, TableHeaderCell, and TableSelectionToolbar record their shipped contract as current (#9271)
Cindy Zhangf77aaf206563
diff --git a/docs/specs/components/Table/Table.spec.md b/docs/specs/components/Table/Table.spec.mdindex 6295bc5bc7..5a22408b59 100644--- a/docs/specs/components/Table/Table.spec.md+++ b/docs/specs/components/Table/Table.spec.md@@ -113,6 +113,9 @@ Consumer migration instructions belong in consumer docs and release notes.- TableHeader, TableBody, TableFooter, and TableRow element contracts;`component:TableHeader`, `component:TableBody`, `component:TableFooter`, and`component:TableRow` own them.+- TableCell, TableHeaderCell, and TableSelectionToolbar contracts;+ `component:TableCell`, `component:TableHeaderCell`, and+ `component:TableSelectionToolbar` own them.## Public conceptsdiff --git a/docs/specs/components/Table/TableBody.spec.md b/docs/specs/components/Table/TableBody.spec.mdindex 550c073132..d3f195abad 100644--- a/docs/specs/components/Table/TableBody.spec.md+++ b/docs/specs/components/Table/TableBody.spec.md@@ -67,8 +67,8 @@ Consumer migration instructions belong in consumer docs and release notes.**Does not own / non-goals**-- Rows — owned by `component:TableRow`; cells — owned by `component:Table`; and- the caller's content.+- Rows — owned by `component:TableRow`; cells — owned by `component:TableCell`+ and `component:TableHeaderCell`; and the caller's content.- Table appearance, data mode, and plugins — owned by `component:Table`.## Public conceptsdiff --git a/docs/specs/components/Table/TableCell.spec.md b/docs/specs/components/Table/TableCell.spec.mdnew file mode 100644index 0000000000..4204663e84--- /dev/null+++ b/docs/specs/components/Table/TableCell.spec.md@@ -0,0 +1,178 @@+---+schema_version: 3+template_version: 7+kind: component+id: component:TableCell+authority: current+archive_reason: null+superseded_by: null+approved_by: cixzhang+approved_at: 2026-11-01+owners: [cixzhang]+review_triggers: [public-api, behavior, layout, theming, accessibility]+verified_by:+ [+ packages/core/src/Table/Table.test.tsx,+ packages/core/src/Table/tableContextMenu.test.tsx,+ packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx,+ packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.glide.test.tsx,+ packages/core/src/Table/__tests__/TableRowGlide.a11y.browser.spec.ts,+ packages/core/src/theme/themingTargets.test.ts,+ scripts/check-knowledge.mjs,+ ]+modules: []+families: []+design_specs: []+architecture:+ [+ architecture:component-theming-surface,+ architecture:public-component-api,+ architecture:container-padding,+ ]+contributing: []+system_specs: []+---++# TableCell component contract++## Contract at a glance++| Area | Contract |+| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| Public contract | `children`, `scope`, `headers`, `colSpan`, `rowSpan`, `contextMenuActions`, `xstyle` (one style or a list), root `BaseProps`, and a `ref`. |+| Behavior | A native `td` carrying the `table-cell` target that takes the enclosing Table's density, overflow, alignment, and divider treatment, optionally inside a context menu. |+| End-user impact | People read cell content with consistent spacing that lines up with the surrounding container, and can open row or cell actions from the cell. |+| Builder impact | None; the record describes shipped behavior. |+| Compatibility/readiness | Released behavior recorded as current; no API, default, or output changes. One implementation gap is listed under Current-state impact. |+| Review checks | Reject a lost target or density reflection, edge padding that ignores the container inset, a context menu trigger that does not fill the cell, or caller props that miss the cell. |+| Governing rules | `architecture:container-padding`; `architecture:public-component-api` INV5–INV8; `architecture:component-theming-surface`. |++This table is a review projection; the body below is authoritative.++## Intent++TableCell is the body cell a caller composes inside a children-mode Table, and+the cell Table renders in data mode. It owns the `td` and the cell treatment+the Table asks for; the caller owns the content.++Consumer syntax and examples belong in `TableCell.doc.mjs`.++## Compatibility and migration++- Released default preserved: `yes`+- Compatibility class: records shipped behavior; no public prop, default, DOM,+ target, or styling output changes.+- Controlled/uncontrolled behavior: not applicable+- Migration decision: none++Consumer migration instructions belong in consumer docs and release notes.++## Current-state impact++- **Edge cells with actions keep their edge padding outside the trigger (FR3,+ FR4).** In the first and last cells of a row, the container-inset padding+ stays on the `td` while the context menu trigger carries its own density+ padding, so a secondary click on that strip opens the browser's menu and the+ content sits one density padding inside the inset.++## Ownership boundary++**Owns**++- The `td` element, which carries the `table-cell` target that `component:Table`+ owns and maps.+- Applying the Table's density, overflow, vertical alignment, and dividers, and+ wrapping content in a context menu when actions are given.++**Does not own / non-goals**++- Density, overflow, alignment, and divider settings — owned by+ `component:Table`.+- The context menu's behavior — owned by `component:ContextMenu`.+- Cell content — owned by the caller.++## Public concepts++| Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior |+| ------------------- | ---------------------------------------- | -------------------------------------------- | ----------------------------------------- | ------- | ------ | --------- | ------------------------------ |+| Table relationships | `scope`, `headers`, `colSpan`, `rowSpan` | Native cell associations and spans. | Always | none | caller | Stable | — |+| Context actions | action list or getter; unset | Actions shown in a context menu on the cell. | Always | none | caller | Stable | An empty list renders no menu. |+| Content | ReactNode | The cell's content. | Always | — | caller | Stable | — |++## Behavioral and layout contract++| ID | Invariant | Basis |+| --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |+| FR1 | TableCell renders one `td` carrying the `table-cell` target, which reflects the Table's density, and holds its content. Outside a Table it adds no cell treatment. | Current source and tests |+| FR2 | Inside a Table, the cell pads by density (`compact` `--spacing-1` by `--spacing-2`, `balanced` `--spacing-2` by `--spacing-3`, `spacious` `--spacing-3` by `--spacing-4`) at body size, wraps or truncates text per the Table's `textOverflow`, aligns vertically per its `verticalAlign`, and draws dividers per its `dividers`: with `rows` or `grid`, a `--border-width` bottom border in `--color-border`, none in the section's last row; with `columns` or `grid`, an inline-end border, none on the row's last cell. While a glide moves its row, the bottom border goes transparent and one cell of the row draws a stand-in across the row's bottom edge (`component:Table` FR14). | Current source and tests |+| FR3 | The first and last cells of a row pad their outer inline edge to the enclosing container's published inset, at least `--spacing-2`, falling back to the density padding outside a container. Implementation gap: in a first or last cell with context actions, the edge padding stays on the `td` outside the trigger, so the content sits one density padding inside the inset (FR4; Current-state impact). | Current source; `architecture:container-padding` |+| FR4 | With context actions (a non-empty list or a getter), the content sits in a context menu trigger that fills the cell and carries the density padding, so the whole cell opens the menu; a getter resolves the actions when the menu opens. Implementation gap: in the first and last cells, the edge padding stays on the `td` outside the trigger, so a secondary click on that strip opens the browser's menu instead (Current-state impact). | Current source and tests |+| FR5 | `ref` reaches the `td`; supported DOM, data, ARIA, and event props reach it before the component's target and styles; `xstyle` (one style or a list), `className`, and `style` compose after component styles. | Current source and tests; `architecture:public-component-api` INV5–INV8 |++### Allowed variation++- **AV1 — Content.** Any content may fill the cell.++### Representative states++| State | Required invariant | Allowed variation |+| -------------- | ---------------------------------------------- | ----------------- |+| Standalone | A `td` with the target and no treatment. | — |+| Each density | Density padding and `data-density`. | — |+| In a container | Outer edge cells align to the container inset. | — |+| With actions | A full-cell context menu trigger. | Actions. |++### Transformation and precedence order++- **ORD1 — Styles.** Table treatment → context-menu adjustment → the glide's+ divider handling → caller `xstyle`, `className`, and `style`.++### Performance and resources++- **PR1 — No resources.** TableCell reads the Table's appearance; a context+ menu loads only when actions are given.++## Accessibility contract++- **AR1 — Native cell semantics.** The `td` keeps its native cell role and the+ caller's `scope`, `headers`, and spans; TableCell adds no role.++## Design relationships++| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |+| ---------------- | ---------------------------------------------- | ------------------------ | -------------- | ------------------ |+| Cell | A body cell with density padding and dividers. | Current source and docs | Supporting | FR1–FR4 |++Theming: the `td` carries the `table-cell` target, which `Table.doc.mjs` maps as+the Cell part of `component:Table`. `TableCell.doc.mjs` declares no anatomy of+its own, so no anatomy-theming block is declared here.++## Family and system relationships++- `component:Table` owns appearance settings and the target mapping.+- `architecture:container-padding` owns the published inset FR3 reads.+- `component:ContextMenu` owns the context menu.++## Verification map++| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |+| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- |+| FR1, AR1 | `Table.test.tsx` children-mode and density-reflection tests; `themingTargets.test.ts` | Children mode; each density | A missing cell, a lost target, or a missing `data-density` fails. `themingTargets.test.ts` catches only a renamed or undocumented target. | `audit:TableCell/anatomy` |+| FR2 | `Table.test.tsx` density, overflow, divider, and vertical-alignment tests; `TableRowGlide.a11y.browser.spec.ts`; `useTableRowExpansion.glide.test.tsx` | Densities; wrap and truncate; dividers; mid-glide, pinned cells, themed and overridden dividers | A mid-glide divider that does not move with its row, or the line on the wrong cell, fails in the glide checks. A truncating Table whose data-mode cells lose their truncating text wrapper, or a cell without the requested `vertical-align`, fails. Gap: the density and divider tests assert only that the table renders, and no test covers the cell's own truncation. | `audit:TableCell/layout` |+| FR3 | Source review | Inside Card, Section, Layout | Gap: no test covers edge cells aligning to the container inset. | `audit:TableCell/layout` |+| FR4 | `tableContextMenu.test.tsx` body-cell row-actions and full-cell tests; `useTableRowExpansion.test.tsx` context-menu action test | Body cell with a list; body cell with a getter (expandable rows); full-cell trigger | A body cell that ignores its action list or getter fails. Gap: the full-cell test checks only that the trigger has a class, so a trigger that does not fill the cell passes; no test covers an empty list or the edge-cell padding outside the trigger. | `audit:TableCell/behavior` |+| FR5, ORD1 | `Table.test.tsx` TableCell ref, `colSpan`, and `rowSpan` tests | `ref`; `colSpan`, `rowSpan` | A ref off the `td` or a dropped `colSpan` or `rowSpan` fails. Gap: no TableCell test covers event props, `xstyle`, `className`, `style`, or the order in which caller styles follow the Table's treatment. | `audit:TableCell/api` |+| PR1 | Source review | Every state | Gap: no automated check covers lazy context-menu loading. | `audit:TableCell/behavior` |++## Decision log++None recorded. The record describes shipped behavior.++## Open questions++None.++## Content boundary++This file does not duplicate consumer prop tables/examples, current audit+results, implementation steps, or Table rules. It links to their owners.diff --git a/docs/specs/components/Table/TableFooter.spec.md b/docs/specs/components/Table/TableFooter.spec.mdindex 5fb78349f9..2c4dd57671 100644--- a/docs/specs/components/Table/TableFooter.spec.md+++ b/docs/specs/components/Table/TableFooter.spec.md@@ -67,8 +67,8 @@ Consumer migration instructions belong in consumer docs and release notes.**Does not own / non-goals**-- Rows — owned by `component:TableRow`; cells — owned by `component:Table`; and- the caller's content.+- Rows — owned by `component:TableRow`; cells — owned by `component:TableCell`+ and `component:TableHeaderCell`; and the caller's content.- Table appearance, data mode, and plugins — owned by `component:Table`.## Public conceptsdiff --git a/docs/specs/components/Table/TableHeader.spec.md b/docs/specs/components/Table/TableHeader.spec.mdindex baed759630..88949434dc 100644--- a/docs/specs/components/Table/TableHeader.spec.md+++ b/docs/specs/components/Table/TableHeader.spec.md@@ -67,8 +67,8 @@ Consumer migration instructions belong in consumer docs and release notes.**Does not own / non-goals**-- Rows — owned by `component:TableRow`; cells — owned by `component:Table`; and- the caller's content.+- Rows — owned by `component:TableRow`; cells — owned by `component:TableCell`+ and `component:TableHeaderCell`; and the caller's content.- Table appearance, data mode, and plugins — owned by `component:Table`.## Public conceptsdiff --git a/docs/specs/components/Table/TableHeaderCell.spec.md b/docs/specs/components/Table/TableHeaderCell.spec.mdnew file mode 100644index 0000000000..f39bb2954c--- /dev/null+++ b/docs/specs/components/Table/TableHeaderCell.spec.md@@ -0,0 +1,169 @@+---+schema_version: 3+template_version: 7+kind: component+id: component:TableHeaderCell+authority: current+archive_reason: null+superseded_by: null+approved_by: cixzhang+approved_at: 2026-11-01+owners: [cixzhang]+review_triggers: [public-api, behavior, layout, theming, accessibility]+verified_by:+ [+ packages/core/src/Table/TableHeaderCell.test.tsx,+ packages/core/src/Table/tableContextMenu.test.tsx,+ packages/core/src/Table/Table.test.tsx,+ packages/core/src/theme/themingTargets.test.ts,+ scripts/check-knowledge.mjs,+ ]+modules: []+families: []+design_specs: []+architecture:+ [+ architecture:component-theming-surface,+ architecture:public-component-api,+ architecture:container-padding,+ ]+contributing: []+system_specs: []+---++# TableHeaderCell component contract++## Contract at a glance++| Area | Contract |+| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |+| Public contract | `children`, `scope`, `contextMenuActions`, `xstyle` (one style or a list), root `BaseProps`, and a `ref`. |+| Behavior | A native `th` carrying the `table-header-cell` target that takes the Table's density and column dividers, always draws its bottom divider, and truncates its text. |+| End-user impact | People see column headings set apart by weight, color, and a rule, aligned with the cells below. |+| Builder impact | None; the record describes shipped behavior. |+| Compatibility/readiness | Released behavior recorded as current; no API, default, or output changes. |+| Review checks | Reject a missing bottom divider, a `scope` the caller did not set, a lost target or density reflection, or caller `xstyle` that loses to context styling. |+| Governing rules | `architecture:container-padding`; `architecture:public-component-api` INV5–INV8; `architecture:component-theming-surface`. |++This table is a review projection; the body below is authoritative.++## Intent++TableHeaderCell is the header cell a caller composes inside a children-mode+Table, as a column header or, with `scope="row"`, a row header, and the column+header cell Table renders in data mode. It owns+the `th` and its header treatment; the caller owns the heading content.++Consumer syntax and examples belong in `TableHeaderCell.doc.mjs`.++## Compatibility and migration++- Released default preserved: `yes` — no `scope` unless given.+- Compatibility class: records shipped behavior; no public prop, default, DOM,+ target, or styling output changes.+- Controlled/uncontrolled behavior: not applicable+- Migration decision: none++Consumer migration instructions belong in consumer docs and release notes.++## Ownership boundary++**Owns**++- The `th` element, which carries the `table-header-cell` target that+ `component:Table` owns and maps.+- Header weight, color, bottom divider, truncation, and the Table's density and+ column dividers on the header cell.++**Does not own / non-goals**++- Sorting, filtering, resizing, and selection controls in headers — owned by+ `component:Table` and its plugins.+- Heading content — owned by the caller.++## Public concepts++| Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior |+| --------------- | ------------------------------------------- | ---------------------------------------------- | ----------------------------------------- | ------- | ------ | --------- | ------------------------------ |+| Scope | `col`, `row`, `colgroup`, `rowgroup`; unset | Native header scope. | Always | unset | caller | Stable | Closed union. |+| Context actions | action list or getter; unset | Actions shown in a context menu on the header. | Always | none | caller | Stable | An empty list renders no menu. |+| Content | ReactNode | The heading. | Always | — | caller | Stable | — |++## Behavioral and layout contract++| ID | Invariant | Basis |+| --- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |+| FR1 | TableHeaderCell renders one `th` carrying the `table-header-cell` target, which reflects the Table's density, holding its content, with `scope` only when given. Outside a Table it adds no header treatment. | Current source and tests |+| FR2 | Inside a Table, the header cell uses semibold `--color-text-secondary` text aligned to the start, pads by the Table's density, truncates its text, aligns its outer edge cells to the container inset like `component:TableCell` FR3, and always draws a `--border-width` `--color-border` bottom divider, even when the Table's dividers are off. With `columns` or `grid` dividers it draws an inline-end divider that the last header cell omits. | Current source and tests |+| FR3 | With context actions, the content sits in a context menu trigger. | Current source and tests |+| FR4 | `ref` reaches the `th`; supported DOM, data, ARIA, and event props reach it before the component's target and styles; `xstyle` (one style or a list) wins over the context styling, and `className` and `style` compose alongside the target. | Current source and tests; `architecture:public-component-api` INV5–INV8 |++### Allowed variation++- **AV1 — Content.** Any heading content may fill the cell.++### Representative states++| State | Required invariant | Allowed variation |+| --------------- | -------------------------------------------------- | ----------------- |+| Standalone | A `th` with the target and no treatment. | — |+| Each density | Density padding and `data-density`. | — |+| Dividers off | The bottom divider still draws. | — |+| Column dividers | Inline-end divider except on the last header cell. | — |++### Transformation and precedence order++- **ORD1 — Styles.** Header treatment → column divider → caller `xstyle`,+ `className`, and `style`.++### Performance and resources++- **PR1 — No resources.** TableHeaderCell reads the Table's appearance and+ holds no state.++## Accessibility contract++- **AR1 — Native header semantics.** The `th` keeps its native header role — a+ column header, or a row header under `scope="row"` or `"rowgroup"` — with the+ caller's `scope` when given; truncation is visual only, so the full heading+ remains its accessible content.++## Design relationships++| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |+| ------------------ | ------------------------------------------------------------- | ------------------------ | -------------- | ------------------ |+| Column header cell | A heading cell set apart by weight, color, and a bottom rule. | Current source and docs | Supporting | FR1, FR2 |++Theming: the `th` carries the `table-header-cell` target, which `Table.doc.mjs`+maps as the Column header cell part of `component:Table`.+`TableHeaderCell.doc.mjs` declares no anatomy of its own, so no anatomy-theming+block is declared here.++## Family and system relationships++- `component:Table` owns appearance settings, header controls, and the target+ mapping.+- `component:TableCell` FR3 defines the edge alignment the header cell shares.++## Verification map++| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |+| --------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |+| FR1, AR1 | `TableHeaderCell.test.tsx` element, scope, and outside-Table tests; `Table.test.tsx` density-reflection test; `themingTargets.test.ts` | Default; `scope`; standalone; densities | A non-`th` element, an unrequested or missing `scope`, styling outside a Table, or a missing target or `data-density` fails. `themingTargets.test.ts` catches only a renamed or undocumented target. | `audit:TableHeaderCell/anatomy` |+| FR2 | `TableHeaderCell.test.tsx` density, weight and color, bottom divider, and column divider tests | Three densities; dividers off, rows, columns, grid | Wrong density padding, weight, or color, a missing bottom divider, or a wrong column divider fails. Gap: truncation and edge alignment have no check. | `audit:TableHeaderCell/layout` |+| FR3 | `tableContextMenu.test.tsx` header context-menu tests | Header cell with actions | A header cell with actions that does not open its menu, or one without actions that does, fails. | `audit:TableHeaderCell/behavior` |+| FR4, ORD1 | `TableHeaderCell.test.tsx` xstyle, array xstyle, ref, attribute, and className and style tests | Caller inputs | A ref off the `th`, a dropped attribute, context styling that beats `xstyle`, or a lost caller class or style fails. | `audit:TableHeaderCell/api` |+| PR1 | Source review | Every state | Gap: no automated check fails if TableHeaderCell adds state. | `audit:TableHeaderCell/behavior` |++## Decision log++None recorded. The record describes shipped behavior.++## Open questions++None.++## Content boundary++This file does not duplicate consumer prop tables/examples, current audit+results, implementation steps, or Table rules. It links to their owners.diff --git a/docs/specs/components/Table/TableRow.spec.md b/docs/specs/components/Table/TableRow.spec.mdindex 6d27bd46f6..0ca4ad18d4 100644--- a/docs/specs/components/Table/TableRow.spec.md+++ b/docs/specs/components/Table/TableRow.spec.md@@ -13,6 +13,8 @@ review_triggers: [public-api, behavior, theming, accessibility]verified_by:[packages/core/src/Table/Table.test.tsx,+ packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.glide.test.tsx,+ packages/core/src/Table/__tests__/TableRowGlide.a11y.browser.spec.ts,packages/core/src/theme/themingTargets.test.ts,scripts/check-knowledge.mjs,]@@ -72,7 +74,8 @@ Consumer migration instructions belong in consumer docs and release notes.- Whether the Table is striped, hoverable, or divided — owned by`component:Table`.-- Cells, which draw the row divider — owned by `component:Table` and the caller.+- Cells, which draw the row divider — owned by `component:TableCell`,+ `component:TableHeaderCell`, and the caller.## Public concepts@@ -87,7 +90,7 @@ Consumer migration instructions belong in consumer docs and release notes.| --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------- || FR1 | TableRow renders one `tr` carrying the `table-row` target and holding its children. Outside a Table it adds no row treatment. | Current source and tests || FR2 | Inside a Table, a body row takes the Table's treatment: with striping, every even body row paints `--color-background-muted`, counting body rows only, so an expansion panel row does not shift the stripes; with hover, a hover-capable pointer paints `--color-overlay-hover`; with both, the hover color replaces the stripe; a row with `aria-disabled="true"` takes no hover. A header row (`isHeaderRow`) takes neither. | Current source and tests |-| FR3 | Inside a Table with `rows` or `grid` dividers, every row, header rows included, is the containing block for its cells' stand-in divider while a glide moves it; the cells draw the divider (`component:Table` FR14). | Current source; `component:Table` FR14 |+| FR3 | Inside a Table with `rows` or `grid` dividers, every row, header rows included, is the containing block for its cells' stand-in divider while a glide moves it; the cells draw the divider (`component:Table` FR14). | Current source and tests; `component:Table` FR14 || FR4 | `ref` reaches the `tr`; supported DOM, data, ARIA, and event props reach it before the component's target and styles; `xstyle`, `className`, and `style` compose on it. | Current source and tests; `architecture:public-component-api` INV5–INV8 |### Allowed variation@@ -142,7 +145,7 @@ its own, so no anatomy-theming block is declared here.| --------- | --------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------- || FR1, AR1 | `Table.test.tsx` row-count, row-class, and standalone-row tests; `themingTargets.test.ts` | Data mode; standalone | A missing row or lost `table-row` class fails. `themingTargets.test.ts` catches only a renamed or undocumented target; no check fails if a standalone row stops carrying its target. | `audit:TableRow/anatomy` || FR2, ORD1 | `Table.test.tsx` header-hover and striped tests | Hover on; striped | A header row that takes hover styling fails. Gap: the striped test asserts only that rows render, and no test covers stripe parity around an expansion panel or the stripe and hover colors. No test covers the hover color replacing the stripe or a row with `aria-disabled="true"` taking no hover. | `audit:TableRow/visual` |-| FR3 | Source review | Rows and grid dividers; a glide; a header row | Gap: no test covers the row as its cells' divider containing block during a glide; `component:Table` FR14's real-browser divider checks are pending. | `audit:TableRow/visual` |+| FR3 | `TableRowGlide.a11y.browser.spec.ts`; `useTableRowExpansion.glide.test.tsx` | Mid-glide; pinned cells; themed and overridden dividers | A divider that does not move with its gliding row, or the line on the wrong cell, fails. Gap: no check isolates a header row as the containing block during a glide. | `audit:TableRow/visual` || FR4 | `Table.test.tsx` row className and style tests, and the TableRow ref and HTML-attribute tests | Inside a Table; standalone; `ref`; `aria-label`, `data-testid` | A caller class, style, ref, or DOM attribute that misses the row fails. Gap: no test covers `xstyle` or the order in which caller styles follow the Table's treatment. | `audit:TableRow/api` || PR1 | Source review | Every state | Gap: no automated check fails if TableRow adds state or a listener. | `audit:TableRow/behavior` |diff --git a/docs/specs/components/Table/TableSelectionToolbar.spec.md b/docs/specs/components/Table/TableSelectionToolbar.spec.mdnew file mode 100644index 0000000000..e8fd55ae3e--- /dev/null+++ b/docs/specs/components/Table/TableSelectionToolbar.spec.md@@ -0,0 +1,166 @@+---+schema_version: 3+template_version: 7+kind: component+id: component:TableSelectionToolbar+authority: current+archive_reason: null+superseded_by: null+approved_by: cixzhang+approved_at: 2026-11-01+owners: [cixzhang]+review_triggers: [public-api, behavior, layout, theming, accessibility]+verified_by:+ [+ packages/core/src/Table/TableSelectionToolbar.test.tsx,+ scripts/check-knowledge.mjs,+ ]+modules: []+families: []+design_specs: []+architecture:+ [+ architecture:component-theming-surface,+ architecture:public-component-api,+ architecture:internationalization,+ ]+contributing: []+system_specs: [spec:AST-085]+---++# TableSelectionToolbar component contract++## Contract at a glance++| Area | Contract |+| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| Public contract | `selection` (from useTableSelectionState), `startContent`, `label`, `renderSelectionLabel`, `clearLabel`, `size`, `variant`, and the other Toolbar props except `endContent`. |+| Behavior | A bulk-actions Toolbar that appears while rows are selected, showing the caller's actions, the selected count, and a command that clears the selection. |+| End-user impact | People act on selected rows together, see how many are selected, and clear the selection in one step. |+| Builder impact | None; the record describes shipped behavior. |+| Compatibility/readiness | Released behavior recorded as current; no API, default, or output changes. One implementation gap is listed under Current-state impact. |+| Review checks | Reject a toolbar shown without a selection, an unlocalized default label, count, or clear label, or a clear command that leaves rows selected. |+| Governing rules | `architecture:internationalization` INV1a; `spec:AST-085` FR4; `architecture:public-component-api`. |++This table is a review projection; the body below is authoritative.++## Intent++TableSelectionToolbar is the bulk-actions bar for a Table with row selection.+It owns when the bar shows, the selection status, and the clear command; the+caller owns the actions.++Consumer syntax and examples belong in `TableSelectionToolbar.doc.mjs`.++## Compatibility and migration++- Released default preserved: `yes` — `sm`, `muted`, localized "Bulk+ actions", "{count} selected", and "Unselect All".+- Compatibility class: records shipped behavior; no public prop, default, DOM,+ target, or styling output changes.+- Controlled/uncontrolled behavior: the selection is the shared state the+ caller passes.+- Migration decision: none++Consumer migration instructions belong in consumer docs and release notes.++## Current-state impact++- **Focus lost after clearing (FR2).** Activating the clear command clears the+ selection, which removes the toolbar and the focused button with it; focus+ falls to the page, so keyboard users lose their place, where `spec:AST-085`+ FR4 has a component that removes a focused control name its destination.++## Ownership boundary++**Owns**++- Showing the toolbar only while rows are selected, the selected-count status,+ and the clear command.++**Does not own / non-goals**++- Toolbar layout, size, and variant — owned by `component:Toolbar`.+- The selection state — owned by useTableSelectionState.+- Bulk actions in `startContent` — owned by the caller.++## Public concepts++| Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior |+| --------------- | --------------------------------------------- | --------------------------------------------------------------------- | ----------------------------------------- | ------------------ | ------------------- | --------- | ------------------------------------ |+| Selection | shared selection state | Whether to show and what to count and clear. | Always | — | caller | Stable | — |+| Labels | `label`, `clearLabel`, `renderSelectionLabel` | The toolbar's name, the clear command's label, and the count content. | Always | localized defaults | caller | Stable | A count renderer may return nothing. |+| Toolbar options | `size`, `variant`, other Toolbar props | Passed to the Toolbar. | Always | `sm`, `muted` | `component:Toolbar` | Stable | — |++## Behavioral and layout contract++| ID | Invariant | Basis |+| --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ |+| FR1 | With no selection, TableSelectionToolbar renders nothing. With a selection, it renders a Toolbar named by `label` (localized "Bulk actions" by default) holding the caller's `startContent`, and at its end the selected-count content (localized "{count} selected" by default, or `renderSelectionLabel`'s result) and a ghost button labelled `clearLabel` (localized "Unselect All"). Default text comes from the catalog (`architecture:internationalization` INV1a). | Current source and tests |+| FR2 | The clear button clears the whole selection through the shared state, which removes the toolbar while the clear button holds focus. `spec:AST-085` FR4 has this record name where focus goes; the destination is open (OQ1). Implementation gap: focus is lost when the toolbar unmounts (Current-state impact). | Current source and tests |+| FR3 | `size` defaults to `sm` and `variant` to `muted`; other Toolbar props pass to the Toolbar, and `endContent` is not accepted. | Current source |++### Allowed variation++- **AV1 — Actions and labels.** Any actions and product-specific labels.++### Representative states++| State | Required invariant | Allowed variation |+| ------------------ | -------------------------------------------- | ----------------- |+| No selection | Nothing renders. | — |+| Selection | Named toolbar, actions, count, clear button. | Labels. |+| Custom empty count | The count renderer may render nothing. | — |++### Transformation and precedence order++- **ORD1 — Labels.** Caller labels → catalog defaults.++### Performance and resources++- **PR1 — No resources.** TableSelectionToolbar holds no state of its own.++## Accessibility contract++- **AR1 — Named toolbar.** The bar is a Toolbar with an accessible name, and+ the clear command is a native button with its label.++## Design relationships++| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |+| ---------------- | -------------------------------------------------------- | ------------------------ | -------------- | ------------------ |+| Bulk actions bar | Actions, count, and clear command for the selected rows. | Current source and docs | Supporting | FR1–FR3 |++Theming: TableSelectionToolbar adds no target; the Toolbar and Button it+renders carry their own. `TableSelectionToolbar.doc.mjs` declares no anatomy,+so no anatomy-theming block is declared here.++## Family and system relationships++- `component:Toolbar` owns layout and theming.+- `spec:AST-085` FR4 owns focus after a focused control is removed; FR2+ records the gap.+- `architecture:internationalization` owns default text; FR1 applies INV1a.++## Verification map++| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |+| -------------- | ------------------------------------------------------------------------------------------------------ | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- |+| FR1, ORD1, AR1 | `TableSelectionToolbar.test.tsx` no-selection, actions and status, empty count, and custom-label tests | No selection; selection; custom labels | A toolbar without a selection, a missing name, count, action, or clear button, or ignored custom labels fail. | `audit:TableSelectionToolbar/behavior` |+| FR2 | `TableSelectionToolbar.test.tsx` clear test | Clear | A clear that leaves rows selected fails. Gap: no test covers where focus goes after clearing. | `audit:TableSelectionToolbar/a11y` |+| FR3, PR1 | `TableSelectionToolbar.test.tsx` defaults test; source review | Defaults | A toolbar that does not default to `sm` and `muted` fails. Gap: no automated check fails if TableSelectionToolbar adds state or a listener. | `audit:TableSelectionToolbar/api` |++## Decision log++None recorded. The record describes shipped behavior.++## Open questions++- **OQ1 — Where does focus go when Clear removes the toolbar?** (`human-api`)+ `spec:AST-085` FR4 has this record name the destination; until it does, a+ keyboard user who clears the selection loses their place.++## Content boundary++This file does not duplicate consumer prop tables/examples, current audit+results, implementation steps, or Table rules. It links to their owners.