Repository navigation
feat(core): TableRow exposes a selected theme state - #11729
Conversation
… state useTableSelection sets the table-row target's selected theme state (data-selected="selected") beside aria-selected and clears it on unselect, whatever hasRowHighlight is, so a theme can style selected rows. The inline selection wash is unchanged; a theme recolors it through --color-accent-muted in that state. Table's doc lists the state, and the TableRow record names it as public theme surface.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec b677087 |
|
/approve-spec 40f3d46 |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Table | 137.9 kB (0) · 19.4 kB CSS (0) | — | — · — · — |
| TableBody | 3.5 kB (0) · 3.3 kB CSS (0) | — | — · — · — |
| TableCell | 121.0 kB (0) · 18.9 kB CSS (0) | — | — · — · — |
5 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| TableFooter | 3.5 kB (0) · 3.3 kB CSS (0) | — | — · — · — |
| TableHeader | 3.5 kB (0) · 3.3 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 120.7 kB (0) · 18.7 kB CSS (0) | — | — · — · — |
| TableRow | 7.1 kB (0) · 4.0 kB CSS (0) | — | — · — · — |
| TableSelectionToolbar | 75.1 kB (0) · 14.0 kB CSS (0) | — | — · — · — |
Package size:
- @astryxdesign/cli 4.41 MB packed (+1.4 kB); no new dependencies
- @astryxdesign/core 7.57 MB packed (+509 B); no new dependencies
API changes: core +0 · ~2 · −0
2 API changes (advisory)
| Package | Where | Signature | Usage | |
|---|---|---|---|---|
| ~ | core |
Theme targets · target table-row (Table) |
target table-row (Table) → target table-row (Table) states [selected] |
defineTheme({components: {'table-row': {…}}}) |
| ~ | core |
Public attributes · attr data-selected |
attr data-selected (theme reflection on 15 targets) → attr data-selected (theme reflection on 16 targets) |
[data-selected] { … } |
Wide change (shared styles: packages/themes/probe/src/probeTheme.ts): add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Requesting changes: the selected theme state on table rows works as described, but the TableRow record still says this change leaves the DOM and the theme target untouched.
docs/specs/components/Table/TableRow.spec.mdstill reads "no API, default, or output changes" in its Compatibility/readiness row and "no public prop, default, DOM, target, or styling output changes" in its Compatibility class, while the new FR5 addsdata-selected="selected"to selected rows and theselectedstate to thetable-rowtarget, so both lines should describe the change as additive.
Non-blocking: the new header sentence in useTableSelection.tsx reads more easily as three short sentences (see the inline suggestion). The three new tests fail before this change and pass after it, and in Chromium a theme rule that sets --color-accent-muted in the selected state recolours the selection wash as the release note says.
Claims and files checked
- Release note: a row that
useTableSelectionselects carries thetable-rowselectedstate — verified (useTableSelection.tsx, new test "marks only selected rows…"). - Release note: a theme styles it with
components: {'table-row': {selected: {…}}}— verified (Table.doc.mjsdeclares the state; new test "matches a theme's selected table-row rule…"). - Release note: the selection wash stays as it was — verified (wash code unchanged, existing wash tests pass, default rendering pixel-identical in Storybook).
- Release note: a theme recolours the wash by setting
--color-accent-mutedin that state — verified (Chromium: the selected rows take the theme's colour). - Description: today a selected row is marked only with
aria-selectedand an inline wash, so no theme selector reaches it — verified against the base. - Description: the state is written with the shared theme attribute helper, beside
aria-selected— verified. - Description: the state is removed on unselect and kept whatever
hasRowHighlightis — verified (new tests). - Description: nothing else in the output changes (wash, row overlay variable,
aria-selected) — verified (diff and existing tests). - Description: callers of
useTableSelectionmake no new decision, and selection still re-renders only the changed checkbox — verified (no config change; the attribute rides the existing row ref; perf tests pass). - Description: TableRow FR5 names the state as public theme surface, Table FR6 points to it, and the theming-surface rule covers selection on the owning target — verified.
- Description: theming-target tests, existing selection tests, the knowledge and changeset checks, eslint and prettier pass — verified.
- Description: writing rubric results R1–R7 — verified.
- File
.changeset/table-row-selected-state.md— clear. - File
docs/specs/components/Table/Table.spec.md— clear. - File
docs/specs/components/Table/TableRow.spec.md— blocking finding above. - File
packages/core/src/Table/Table.doc.mjs— clear. - File
packages/core/src/Table/plugins/selection/useTableSelection.test.tsx— clear. - File
packages/core/src/Table/plugins/selection/useTableSelection.tsx— non-blocking comment suggestion. - File
packages/themes/probe/src/probeTheme.ts— clear (regenerated fixture; the generator's check reports it current).
…nts it with The part data reads the paint Core writes inline when it sets a theme state at run time (the selection plugin's wash beside a row's selected state), so table-row in selected reads --color-accent-muted. how answers a selected-row background with that token on table-row --state selected, and a background there, which the inline wash would hide, is refused with that command.
|
/approve-spec 98e6916 |
There was a problem hiding this comment.
Requesting changes: the selected theme state on table rows and the theme editor's new answer for it both work, but the TableRow record's compatibility lines are still unchanged since the last review.
docs/specs/components/Table/TableRow.spec.mdstill reads "no API, default, or output changes" in its Compatibility/readiness row and "no public prop, default, DOM, target, or styling output changes" in its Compatibility class, while FR5 addsdata-selected="selected"to selected rows and theselectedstate to thetable-rowtarget, so both lines should describe the change as additive.
Non-blocking: the editor's new refusal says no theme rule can replace the selected-row wash, which does not hold for a table with hasRowHighlight={false}, where there is no wash and the suggested token paints nothing (see the inline note), and the earlier header comment suggestion in useTableSelection.tsx still applies. The two new editor tests fail without the editor commit and pass with it, and a theme rule in the selected state recolours the wash in Chromium as the release note says.
Claims and files checked
- Core release note: a row that
useTableSelectionselects carries thetable-rowselectedstate — verified (useTableSelection.tsx, test "marks only selected rows…"). - Core release note: a theme styles it with
components: {'table-row': {selected: {…}}}— verified (Table.doc.mjs, test "matches a theme's selected table-row rule…"). - Core release note: the selection wash stays as it was — verified (wash code unchanged; default rendering pixel-identical).
- Core release note: a theme recolours the wash by setting
--color-accent-mutedin that state — verified (Chromium). - Editor release note: the editor's part data reads the paint Core writes inline for a state, so a selected table row reads
--color-accent-muted— verified (_parts.mjs; only the selection module matches in the built Core). - Editor release note:
how "selected table row light blue"answers with--color-accent-muted … --on table-row --state selected— verified (test passes; fails without the editor commit). - Editor release note: a background on a selected table row is refused with that command — verified for the default row highlight (test passes); see the non-blocking note for
hasRowHighlight={false}. - Description: today a selected row is marked only with
aria-selectedand an inline wash, and the editor has no selected state to offer — verified against the base. - Description: the state is written with the shared theme attribute helper beside
aria-selected, removed on unselect, and kept whateverhasRowHighlightis — verified (code and tests). - Description: nothing else in the output changes, callers make no new decision, and selection still re-renders only the changed checkbox — verified (diff, unchanged config, passing perf tests).
- Description: TableRow FR5 names the state as public theme surface, Table FR6 points to it, and the theming-surface rule covers selection on the owning target — verified.
- Description: theming-target tests, existing selection tests, the knowledge and changeset checks, eslint and prettier pass — verified at this revision, editor files included.
- Description: writing rubric results — verified.
- Description scope (Table, TableRow) — narrower than the change, since it does not mention the editor commit; not false.
- File
.changeset/experimental-theme-table-row-selected.md— clear. - File
.changeset/table-row-selected-state.md— clear. - File
docs/specs/components/Table/Table.spec.md— clear. - File
docs/specs/components/Table/TableRow.spec.md— blocking finding above. - File
packages/cli/api/theme-edit/_check.mjs— non-blocking note. - File
packages/cli/api/theme-edit/_how-question.mjs— clear. - File
packages/cli/api/theme-edit/_parts.mjs— clear. - File
packages/cli/api/theme-edit/theme-edit.test.mjs— clear. - File
packages/cli/api/theme-edit/theme-how.test.mjs— clear. - File
packages/core/src/Table/Table.doc.mjs— clear. - File
packages/core/src/Table/plugins/selection/useTableSelection.test.tsx— clear. - File
packages/core/src/Table/plugins/selection/useTableSelection.tsx— non-blocking comment suggestion. - File
packages/themes/probe/src/probeTheme.ts— clear (regenerated fixture; the generator's check reports it current).
The TableRow record's compatibility lines say a selected row gains data-selected="selected" and the table-row target gains the selected state, and its builder impact names the state. The selection hook's header says the same in short sentences. The editor's refusal of a selected table-row background says both cases: by default Core paints it inline from --color-accent-muted, and only where the component is set not to paint it does a selected background apply.
|
/approve-spec b123fcb |
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this head yet. The selected theme state on table rows, the theme editor's answer for it, and the TableRow record now agree, and the earlier record, comment and refusal-wording notes are all addressed.
Non-blocking: the editor's refusal now says a selected background does apply on a table with its row highlight off, but it still refuses that background and offers only the token command, so editor users with such tables have no route to the setting that works for them (see the inline note).
Claims and files checked
- Core release note: a row that
useTableSelectionselects carries thetable-rowselectedstate — verified (useTableSelection.tsx, test "marks only selected rows…"). - Core release note: a theme styles selected rows with
components: {'table-row': {selected: {…}}}— verified (Table.doc.mjs, test "matches a theme's selected table-row rule…"). - Core release note: the selection wash stays as it was — verified (wash code unchanged; default rendering pixel-identical in Chromium).
- Core release note: a theme recolours the wash by setting
--color-accent-mutedin that state — verified (the inline wash reads that variable; Chromium shows the recoloured rows). - Editor release note: the part data reads the paint Core writes inline for a state, so a selected table row reads
--color-accent-muted— verified (_parts.mjs; only the selection module matches in the built Core). - Editor release note:
how "selected table row light blue"answers with--color-accent-muted … --on table-row --state selected— verified (theme-how.test.mjs). - Editor release note: a background on a selected table row is refused with that command — verified (
theme-edit.test.mjs); the refusal names the highlight-off exception. - Description: before this change a selected row had only
aria-selectedand an inline wash, and the editor had no answer for a selected table row — verified against the base. - Description: the state is written with the shared theme attribute helper beside
aria-selected, removed on unselect, and kept whateverhasRowHighlightis — verified (code and tests). - Description: nothing else in the output changes, callers make no new decision, and selection still re-renders only the changed checkbox — verified (diff, unchanged config, passing selection and perf tests).
- Description: TableRow FR5 names the state as public theme surface, Table FR6 points to it, and the theming-surface rule covers selection on the owning target — verified.
- Description: theming-target tests, existing selection tests, the knowledge and changeset checks, ESLint and Prettier pass — verified at this revision.
- Description: writing rubric results — verified.
- Description scope (Table, TableRow) — narrower than the change, since it does not mention the editor commit; not false.
- File
.changeset/experimental-theme-table-row-selected.md— clear. - File
.changeset/table-row-selected-state.md— clear. - File
docs/specs/components/Table/Table.spec.md— clear. - File
docs/specs/components/Table/TableRow.spec.md— clear (compatibility lines now additive). - File
packages/cli/api/theme-edit/_check.mjs— non-blocking note. - File
packages/cli/api/theme-edit/_how-question.mjs— clear. - File
packages/cli/api/theme-edit/_parts.mjs— clear. - File
packages/cli/api/theme-edit/theme-edit.test.mjs— clear. - File
packages/cli/api/theme-edit/theme-how.test.mjs— clear. - File
packages/core/src/Table/Table.doc.mjs— clear. - File
packages/core/src/Table/plugins/selection/useTableSelection.test.tsx— clear. - File
packages/core/src/Table/plugins/selection/useTableSelection.tsx— clear. - File
packages/themes/probe/src/probeTheme.ts— clear (regenerated fixture; the generator's check reports it current).
| if (inline) | ||
| refuse( | ||
| E.ERR_THEME_NO_EFFECT, | ||
| `By default Core paints ${inline[0]}'s ${family} when ${s.state} as an inline style from ${inline[1]}, which no theme rule can replace, so set ${inline[1]} on ${inline[0]} when ${s.state} instead; only where the component is set not to paint it (such as a table with its row highlight off) does a ${s.state} ${family} apply, and there ${inline[1]} paints nothing.`, |
There was a problem hiding this comment.
Non-blocking: this refusal now says a selected background does apply on a table with its row highlight off (hasRowHighlight={false}, Table FR21), but it still refuses it and offers only the --color-accent-muted command, which paints nothing there. An editor user whose tables all turn the highlight off has no route through set to the setting that works for them. A second run suggestion for that case (or a pointer to where such a background can be written) would close the gap; the sentence is also about 70 words of CLI output.
User need
A theme author who styles tables cannot style a selected row.
useTableSelectionpaints the selection wash as an inline style and marks the row only witharia-selected, so no theme selector reaches it: a theme that wants a stronger selected fill, a bold label or a left accent on selected rows has no hook. The theme editor cannot offer--state selectedon a table row for the same reason.Problem and solution fit
A selected row now carries the
table-rowtarget'sselectedtheme state (data-selected="selected"), written with the samethemeDataAttributeshelper every other theme state uses, besidearia-selected. A theme styles it withcomponents: {'table-row': {selected: {…}}}. The inline wash is unchanged, so every existing table looks the same; a theme recolors the wash by setting--color-accent-mutedin that state, which the inline background reads.Current specification
component:TableRowFR5 (added here) names the state and why it is public theme surface, asarchitecture:public-component-apiDEC-2 requires for a data attribute outsidedata-astryx-*.architecture:component-theming-surfaceINV6: selection is reflected on the owning target through the theme state helpers.component:TableFR6 now points to TableRow FR5.Public delta and caller burden
selectedon thetable-rowtarget, listed in Table's doc (states: ['selected']).data-selected="selected"; it is removed on unselect, and it is set whateverhasRowHighlightis. Nothing else in the output changes: the inline wash,--table-row-overlayandaria-selectedare as before.useTableSelectionmake no new decision.Design and alternatives
The state follows the existing selection convention (
selected: 'selected', as on Tab, SideNavItem, Item and others) and is written wherearia-selectedis, in the imperative row-styling path, so selection keeps re-rendering only the changed checkbox. Rejected: moving the wash from an inline style to a stylesheet rule keyed on the state. It would let a theme replace the background directly, but it changes the DOM of every selected row and the documentedhasRowHighlightcontract; the token route gives the same control with unchanged output.Evidence
useTableSelection.test.tsx: the state appears only on the selected row and goes on unselect; it is kept withhasRowHighlight={false}(and no inline wash); a theme's compiledselectedrule matches a selected row and not an unselected one.themingTargets.test.tspasses with the new documented state.aria-selected, select all, perf) pass unchanged.Writing rubric results
R1 narration: none; FR5 and the Public concepts row describe present behavior, and Table FR6's status cell states the current fact.
R2 research: none in the record; the rejected alternative is one sentence in this description, not in the record.
R3 evidence: the new verification row names the test file and the cases, no pull request.
R4 rejected alternatives: none recorded.
R5 change references: none.
R6 open questions: none added.
R7 project status: none.
Scope
Components: Table, TableRow
Testing
vitest run --project ui packages/core/src/Table/plugins/selection packages/core/src/theme/themingTargets.test.tspnpm check:knowledge,node scripts/check-changesets.mjs, eslint and prettier on changed files.