Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report
Generated by PR Enrichment workflow | View current CI run |
…value A SelectableCard with a `value` in place of `isSelected` and `onChange` is a member of the SelectableCardGroup around it. The group gives the card its selection, its input (a radio in a single choice, a checkbox in several), its input name and its disabled default, and the card sends the group its selection requests. Membership stops at a layer boundary. The new SelectableCardMemberProps type describes a member. SelectableCardProps stays an interface and gains only `value?: never`, so TypeScript rejects `isSelected` or `onChange` beside `value`. Outside a group, a card with a `value` warns in development and stays unselected. Lab's SelectableCardGroup takes these cards as its children, so SelectableCardGroupItem and SelectableCardGroupItemProps are removed. The `component:SelectableCard` record admits `value` (DEC-1).
a60f64c to
9e86180
Compare
|
Rebased onto main at a92c1ce; the new head is 9e86180. Conflicts came up only in the SelectableCard record and On this head, |
|
/approve-spec 9e86180 |
docs/specs/components/SelectableCard/SelectableCard.spec.md: the verification map keeps main's rows and this branch's group-membership row. No other change.
|
/approve-spec c903d9b |
There was a problem hiding this comment.
Changes requested. The amended SelectableCard record is approved at this head; these code and description issues still need to change:
- The card's props type stops being extendable in a patch release: changing
SelectableCard's parameter toSelectableCardProps | SelectableCardMemberPropsmakesinterface X extends ComponentProps<typeof SelectableCard>fail (TS2312) and stopsOmit<ComponentProps<typeof SelectableCard>, …>from spreading back onto the card (TS2322), a type break thatspec:AST-017FR25 rules out in a patch and that makes "A standalone card does not change" (Changeset), "keeps its props" (description) and "additive" (record) untrue, so declare two overloads, the member signature first and the standalone one last, which compile locally and still reject both and neither. - New internal shared module that no record names:
selectableCardGroupContext.ts, re-exported through Core'sinternal/selectable-cardentry for Lab, needsSelectableCardGroupContextand its membership shape named in the SelectableCard record with whySelectableCardInputContextwas not enough (architecture:knowledge-contractsDEC-22), and that record edit then needs a fresh/approve-spec. - Stable Core output names a Lab-only component: the development warning, the exported JSDoc,
SelectableCard.doc.mjsand the Core Changeset point consumers atSelectableCardGroup, whichspec:AST-017FR27 forbids while the group is in Lab, so merge this together with the group's move to Core or keep those mentions out of Core until then. - Every SelectableCard page pays 329 bytes gzip for an opt-in feature: measured locally with the boundary check's own measurement, a page that renders
SelectableCardwithoutvalueloads 18,339 instead of 18,010 bytes of gzip JavaScript, over the 0.3 KBarchitecture:component-import-boundariesINV10 allows, and dropping theuseDevWarningcall brings the growth to 109 bytes. - A card with a stray
valueis not inert: the description and the approved Group value row say such a card "renders unselected and inert", but it keeps its hover and press paint, runs the caller'sonClickand stays an enabled checkbox, so treat a card with avalueand no group as disabled and assert that in its test. - The description misstates what #13734 does: that pull request keeps Core's
internal/selectable-cardentry and removes only the context exports andjoinAriaIDs, so reword "#13734 removes the entry when the group moves to Core."
The member behaviour itself checks out locally: the three test files pass, the type guards reject both and neither, and membership stops at a layer.
Claims and files checked
Review mode: full; reason: recipe-changed (many rules)
Claims:
- Title: a card joins its group by value: verified (
SelectableCard.tsx:518-547; member tests inSelectableCardRadio.test.tsx, run locally) - Changeset: a card with a value is a member of the group around it, which gives it its selection, input and disabled default: verified (
SelectableCard.tsx:520-536; radio, checkbox and disabled member tests, run locally) - Changeset: in a single choice the card is a native radio that selects and never deselects itself: verified (
SelectableCard.tsx:536,:544-545; the "never deselects itself" test) - Changeset: in a multiple choice the card is a checkbox that submits its value under the group's name: verified (
SelectableCard.tsx:673-674; Lab group sets the input name to the submit name; checkbox member test) - Changeset: a new props type describes a member: verified (
SelectableCard.tsx:404-418;SelectableCard/index.ts) - Changeset and description: the existing props type stays an interface and gains only an optional never-typed value, so extending it and omitting from it keep working: verified (built API surface of both trees; the props-type test, compiled locally)
- Changeset and description: TypeScript rejects isSelected or onChange beside value, and a card with neither: verified (compiled locally; the test's expect-error lines pass CI typecheck)
- Changeset: outside a group, a card with a value warns in development and stays unselected: verified (
SelectableCard.tsx:522-530; test atSelectableCardRadio.test.tsx:337) - Changeset: a standalone card does not change: false (derived props types break, TS2312 and TS2322, compiled locally)
- Description: today a single choice needs Lab's own item component, which repeats the card's props, and the card's record keeps single choice out of its contract: verified (base group source and base record)
- Description: the group gives a member its selection, input, input name and disabled default, the card sends selection requests, and a radio only selects: verified (
SelectableCard.tsx:520-547) - Description: the group's children are SelectableCards, the item component and its props type are removed, and one private context replaces the wrapper: verified (Lab index files; no remaining reference anywhere in the repository, searched)
- Description: the chosen, enabled radio card renders the hidden input that submits the group's value under its form name: verified (
SelectableCard.tsx:693-695; form-value test) - Description: membership stops at a layer, in a popover or a dialog, as the toggle-button group's context does: verified (layer test, run locally; every layer renders the same content boundary; the toggle-button group uses the same layer-scoped context)
- Description: the card's record admits the member case with a decision, a group value concept and the member contract: verified (record diff; approved at this head)
- Description: Lab reaches the context through Core's internal entry, which now exports the group context: verified (
internal/selectable-card.ts:18-19) - Description: the follow-up pull request removes that entry: false (its diff keeps the entry)
- Description: a card is typed as standalone or as a member, never both: verified (compiled locally)
- Description: under the compatibility rule the change is additive because the props type keeps its members and the member shape is a new type: false for the component's derived props type (compiled locally)
- Description: the public delta block shows the union parameter: matches the code (
SelectableCard.tsx:513), which is the compatibility finding - Description: a standalone card keeps its props, defaults, DOM and behaviour: false for its derived props type; defaults, DOM and behaviour verified (
SelectableCard.test.tsx, 21 tests, run locally) - Description: outside a group, a card with a value warns once in development and renders unselected and inert: warns once per card and unselected verified; inert false (
SelectableCard.tsx:621,:644,:654,:683; probed locally) - Description: a member's own disabled state adds to the group's, and a disabled member submits nothing: verified (
SelectableCard.tsx:533,:679,:693; disabled and form tests) - Description: in a group's DOM only the hidden submit input moves, with no theming target, data attribute, token or string change: verified by comparing both render paths (no new target, attribute, token or catalog string; the only new text is a console development warning)
- Description: the new type name is the owner decision, approved with the record: verified (approved at this head)
- Description: the rejected designs and why the card renders the hidden input: reasoning; the shipped union parameter has the same extension break the description gives for rejecting a union props type
- Description: this should not ship in a release without the follow-up pull request: reported intent; nothing enforces it (stable-output finding)
- Description: before and after screenshots, pixel-identical, with matching input attributes: reported (taken before the last rebase)
- Description: the listed unit cases: verified by reading and running the three test files locally (49 passed); mutation and Chromium results: reported (the Chromium spec runs in deferred CI)
- Description: local preflight and test runs: reported
- Description: the latest main merge only keeps main's verification rows and adds this branch's row: verified (per-file patch comparison with the previous head; only the nested-control row differs, as on main)
- Description: scope checklist (one capability, no unrelated changes, docs and tests ship, no internal context): verified (no tagalong; public text clean)
- Description: writing rubric results for the record: verified (present tense; one rejected alternative; the rewritten rows keep main's gap wording)
Files:
.changeset/selectable-card-group-value.md: finding (names the Lab-only group; "A standalone card does not change")apps/storybook/stories/SelectableCardGroup.stories.tsx: cleardocs/specs/components/SelectableCard/SelectableCard.spec.md: finding (the Owns bullet does not name the context; "inert" in the Group value row; "additive" compatibility rows)packages/cli/test/swizzle-proof/samples.mjs: clearpackages/core/src/SelectableCard/SelectableCard.doc.mjs: finding (names the Lab-only group)packages/core/src/SelectableCard/SelectableCard.tsx: finding (union parameter; Lab-only name in the warning and JSDoc; size; stray value stays interactive)packages/core/src/SelectableCard/SelectableCardRadio.test.tsx: finding (the "inert" test checks only selection)packages/core/src/SelectableCard/index.ts: clearpackages/core/src/SelectableCard/selectableCardGroupContext.ts: finding (no record names it)packages/core/src/SelectableCard/selectableCardInput.ts(deleted): clearpackages/core/src/internal/selectable-card.ts: finding (re-exports the unnamed module)packages/lab/blocks/SelectableCardGroupShippingSpeed.doc.mjs: clearpackages/lab/blocks/SelectableCardGroupShippingSpeed.tsx: clearpackages/lab/blocks/SelectableCardGroupShowcase.doc.mjs: clearpackages/lab/blocks/SelectableCardGroupShowcase.tsx: clearpackages/lab/src/SelectableCardGroup/SelectableCardGroup.doc.mjs: clearpackages/lab/src/SelectableCardGroup/SelectableCardGroup.test.tsx: clearpackages/lab/src/SelectableCardGroup/SelectableCardGroup.tsx: clearpackages/lab/src/SelectableCardGroup/index.ts: clearpackages/lab/src/index.ts: clear
…inert - Two call signatures, the member one first, keep `ComponentProps<typeof SelectableCard>` the standalone interface, so a wrapper that extends or omits from it compiles again. - A card with a `value` outside a group is disabled: no click, no hover or press paint, and its checkbox reads as disabled. - Drop the development warning. The inert card shows the mistake, and the warning was most of the card's added bundle size. - Core's JSDoc, doc and changeset say "card group" and name no Lab surface. - Keep the internal `selectableCardInput.ts` module and its `SelectableCardInputContext` name for the group's membership context, instead of a new module. - Add a story for a card with a value outside a group. Co-authored-by: Ernest Tien <ernesttien@meta.com>
|
/approve-spec d4f41c2 |
There was a problem hiding this comment.
Changes requested. The member API works as described, and the amended SelectableCard record is approved at this head. Three statements do not match what this head ships:
- The record promises a development warning the code no longer emits: the record's Group value row says a card with a
valueoutside a group "warns in development", but this head only disables it, so reword that sentence (for example "renders unselected and disabled (FR5)") and have an engineering owner re-approve the record. - The description's public delta still shows the union signature: the code block under "Public delta and caller burden" declares
SelectableCard(props: SelectableCardProps | SelectableCardMemberProps): ReactNode, so replace it with the two overloads this head ships. - Formatting churn contradicts the scope checklist:
SelectableCard.doc.mjsre-wraps entries this change does not touch (usage, anatomy,padding,variant,elevation,xstyle, theming), so restore main's layout for those entries or uncheck "Unrelated fixes, cleanup, and policy changes were removed or split".
Non-blocking:
- Bump the context's protocol version:
SelectableCardInputContextchanged its value's shape but keeps version 1, and version 2 would keep an older Core copy from reading the new shape. - The context's JSDoc names too narrow a layer: its comment says membership stops for a layer "opened from a member", but it stops for any layer opened inside the group.
Run locally, the targeted tests (49), the Lab typecheck, strict lint and the knowledge check pass, and the page that renders the card grows by 121 bytes gzip.
Claims and files checked
Review mode: full; reason: requested
Claims:
- Title: a card joins its group by value: verified (member path in the card; member tests run locally)
- Changeset: a card with a value takes selection, input and disabled default from its group: verified (member tests)
- Changeset: in a single choice the card is a radio that never deselects; in several choices it submits its value under the group's name: verified (radio and checkbox member tests, form data)
- Changeset: a new member props type; the standalone props stay an interface and gain only a never-typed value, so both together are rejected: verified (generated API delta; local typecheck)
- Changeset: a card with a value outside a group is unselected, reads as disabled and ignores clicks: verified (test; story probe)
- Changeset: a standalone card keeps its props type, DOM and behavior: verified (unchanged standalone tests pass; probe)
- Description: the Lab item repeated every card prop except selection and change: verified (base Lab source)
- Description: the card record kept single-select out of its public contract: verified (base record)
- Description: members take input type, name and disabled default from the group, send it requests, and a radio only selects: verified (code; tests)
- Description: the Lab item and its props type are removed, and the group provides one private context: verified (no references remain)
- Description: the chosen, enabled radio card renders the hidden submit input: verified (form-data test; DOM probe)
- Description: membership stops at a popover or dialog opened inside the group: verified (dialog test; popovers render the same layer boundary)
- Description: Lab reaches the context through Core's unchanged internal entry, and the follow-up removes the context exports and the aria-id joiner: verified (entry identical to base; follow-up's file at its head)
- Description: the record amendment needs an owner approval: verified (approved at this head)
- Description: a card is typed as standalone or member, never both, and two call signatures keep the derived props the standalone interface: verified (local typecheck)
- Description: Public delta block declares one union-typed signature: false (two overloads ship)
- Description: a standalone card keeps props, defaults, DOM and behavior; extending and omitting the derived props keep working: verified (typecheck of the test that pins both)
- Description: a stray card shows no hover or press paint and ignores clicks and keys: verified (disabled path; test)
- Description: a member's own disabled state adds to the group's, and a disabled member submits nothing: verified (tests)
- Description: in a group's DOM only the hidden submit input moves; no theming target, data attribute, token or string changes: verified (DOM probe; identical frames; API delta)
- Description: Core output names no Lab surface and has no development warning: verified (search of Core source, docs and changeset)
- Description: screenshots and pixel-identical states: reported (consistent with the identical frames captured locally)
- Description: listed unit cases: verified (each present; run locally)
- Description: mutation and red-first results: reported
- Description: browser spec results: reported (CI has not run)
- Description: one capability is added: verified
- Description: unrelated fixes and cleanup were removed or split: false (the docs file is re-wrapped)
- Description: docs, tests and migration ship; no internal context: verified
- Description: writing rubric results for the record: verified
- Description: preflight and test runs: reported; the targeted tests, Lab typecheck, strict lint and knowledge check re-run locally
- Description: first-load size moves from 18,010 to 18,131 bytes: verified (measured locally); the previous head's figure: reported
- Description: a new story shows a card with a value outside a group: verified
Files:
.changeset/selectable-card-group-value.md: clearapps/storybook/stories/SelectableCard.stories.tsx: clearapps/storybook/stories/SelectableCardGroup.stories.tsx: cleardocs/specs/components/SelectableCard/SelectableCard.spec.md: finding (stray-card warning sentence)packages/cli/test/swizzle-proof/samples.mjs: clearpackages/core/src/SelectableCard/SelectableCard.doc.mjs: finding (layout-only churn)packages/core/src/SelectableCard/SelectableCard.tsx: clearpackages/core/src/SelectableCard/SelectableCardRadio.test.tsx: clearpackages/core/src/SelectableCard/index.ts: clearpackages/core/src/SelectableCard/selectableCardInput.ts: two non-blocking notespackages/lab/blocks/SelectableCardGroupShippingSpeed.doc.mjs: clearpackages/lab/blocks/SelectableCardGroupShippingSpeed.tsx: clearpackages/lab/blocks/SelectableCardGroupShowcase.doc.mjs: clearpackages/lab/blocks/SelectableCardGroupShowcase.tsx: clearpackages/lab/src/SelectableCardGroup/SelectableCardGroup.doc.mjs: clearpackages/lab/src/SelectableCardGroup/SelectableCardGroup.test.tsx: clearpackages/lab/src/SelectableCardGroup/SelectableCardGroup.tsx: clearpackages/lab/src/SelectableCardGroup/index.ts: clearpackages/lab/src/index.ts: clear
…yout - The Group value row says a card with a `value` outside a group renders unselected and disabled (FR5), as it now does; it no longer promises a development warning. - Restore SelectableCard.doc.mjs's layout for entries this change does not touch; only the six "card group" wordings differ from before. - Bump SelectableCardInputContext's protocol version to 2: its value changed shape, so an older copy on the page never reads it. - Say exactly where membership stops at a layer boundary. Co-authored-by: Ernest Tien <ernesttien@meta.com>
|
/approve-spec 9a66a04 |
There was a problem hiding this comment.
Changes requested. The member API works as described, the amended SelectableCard record is approved at this head, and the earlier record wording, docs layout and context version points are fixed; one statement in the description still does not match what ships:
- The description's public delta still shows the union signature: the code block under "Public delta and caller burden" ends with
export function SelectableCard(props: SelectableCardProps | SelectableCardMemberProps): ReactNode;, but this head ships two overloads that returnReact.JSX.Element, the member one first (SelectableCard.tsx:469-504), so replace that line with those two overloads.
The fix is a description edit only. Run locally, the SelectableCard and SelectableCardGroup tests (49), the type checks, strict lint and the knowledge check pass, the group stories render pixel-identical to main, and a page that renders the card grows by 124 bytes gzip.
Claims and files checked
Review mode: full; reason: author-not-engowner
Claims:
- Title: a card joins its group by value: verified (member tests run locally)
- Changeset: a card with a value takes its selection, input and disabled default from its group: verified (member tests)
- Changeset: in a single choice the card is a native radio that never deselects itself; in several choices it is a checkbox that submits its value under the group's name: verified (radio and checkbox member tests, form data)
- Changeset: a new member props type; the standalone props stay an interface and gain only a never-typed value, so selection props beside a value are rejected: verified (generated API delta; local type probe)
- Changeset: a card with a value outside a group reads as disabled and ignores clicks: verified (unit test; story probe)
- Changeset: a standalone card keeps its props type, DOM and behavior: verified (unchanged standalone tests pass; identical frames)
- Description: the Lab item repeated every card prop except selection and change: verified (base Lab source)
- Description: the card record kept single-select out of its public contract until the group reached Core: verified (base record)
- Description: members take input type, name and disabled default from the group and send it selection requests; a radio only selects: verified (code; tests)
- Description: the Lab item and its props type are removed, and the group provides one private context: verified (no references remain in the repository)
- Description: the chosen, enabled radio card renders the hidden submit input: verified (form-data test; DOM probe)
- Description: membership stops at a popover or dialog opened inside the group, as the toggle-button group's context does: verified (dialog test; popover probe run locally; same layer-scoped helper)
- Description: the record describes the member case (the new decision, the group value concept, the member requirements): verified (record at this head)
- Description: Lab reaches the context through Core's unchanged internal entry, and the follow-up removes the context exports and the aria-id joiner: verified (entry identical to main; the follow-up's entry keeps only the field styling hook)
- Description: the record amendment needs an engineering owner's approval: verified (approved at this head)
- Description: a card is typed as standalone or member, never both, and two call signatures keep the derived props the standalone interface: verified (local type probe)
- Description: the public delta code block declares one union-typed signature returning ReactNode: false (two overloads returning JSX elements ship)
- Description: extending and omitting the derived props keep working, and a test pins both: verified (type check of that test)
- Description: TypeScript rejects selection props beside a value, and a card with neither: verified (local type probe, including the change handler beside a value)
- Description: a stray card is disabled, shows no hover or press paint and ignores clicks and keys: verified (disabled path; unit test; hover and click probe)
- Description: a member's own disabled state adds to the group's, and a disabled member submits nothing: verified (tests)
- Description: in a group's DOM only the hidden submit input moves, and no theming target, data attribute, token or string changes: verified (DOM probe; identical frames; API delta)
- Description: the owner decision is the new type's name, approved with the record: verified (the record names it; approved at this head)
- Description: the rejected alternatives (a union props type, optional ignored props, keeping the item): design rationale, not shipped behavior
- Description: Core output names no Lab surface and has no development warning: verified (search of Core source, docs and changeset)
- Description: screenshots and pixel-identical states: reported (consistent with six identical pairs captured locally)
- Description: the listed unit cases: verified (each present; run locally)
- Description: mutation and red-first results: reported
- Description: browser spec and swizzle-proof results: reported (CI has not run them on this head)
- Description: one capability is added: verified
- Description: unrelated fixes and cleanup were removed or split: verified (the docs file keeps main's layout)
- Description: docs, tests and migration ship, and no internal context appears: verified
- Description: writing rubric results for the record: verified
- Description: preflight and test runs on earlier heads: reported; the targeted tests, type checks, strict lint and knowledge check re-run locally
- Description: first-load size 18,010 to 18,131 bytes at the previous head: reported; 18,134 bytes measured locally at this head
- Description: a new story shows a card with a value outside a group: verified
Files:
.changeset/selectable-card-group-value.md: clearapps/storybook/stories/SelectableCard.stories.tsx: clearapps/storybook/stories/SelectableCardGroup.stories.tsx: cleardocs/specs/components/SelectableCard/SelectableCard.spec.md: clearpackages/cli/test/swizzle-proof/samples.mjs: clearpackages/core/src/SelectableCard/SelectableCard.doc.mjs: clearpackages/core/src/SelectableCard/SelectableCard.tsx: clear (the description misstates its signatures)packages/core/src/SelectableCard/SelectableCardRadio.test.tsx: clearpackages/core/src/SelectableCard/index.ts: clearpackages/core/src/SelectableCard/selectableCardInput.ts: clearpackages/lab/blocks/SelectableCardGroupShippingSpeed.doc.mjs: clearpackages/lab/blocks/SelectableCardGroupShippingSpeed.tsx: clearpackages/lab/blocks/SelectableCardGroupShowcase.doc.mjs: clearpackages/lab/blocks/SelectableCardGroupShowcase.tsx: clearpackages/lab/src/SelectableCardGroup/SelectableCardGroup.doc.mjs: clearpackages/lab/src/SelectableCardGroup/SelectableCardGroup.test.tsx: clearpackages/lab/src/SelectableCardGroup/SelectableCardGroup.tsx: clearpackages/lab/src/SelectableCardGroup/index.ts: clearpackages/lab/src/index.ts: clear
There was a problem hiding this comment.
Changes requested. The member API works as described and the amended SelectableCard record is approved for this revision; one compatibility statement in the description and the changeset promises more than ships.
- Miss: The compatibility claim misses wrappers that declare their own
value:SelectableCardPropsnow carriesvalue?: never(SelectableCard.tsx:399), so a type such asinterface PlanCardProps extends SelectableCardProps { value: string }, or the same built onComponentProps<typeof SelectableCard>, compiled before and now fails with TS2430 (reproduced locally), while the description says those extensions "keep working" and the changeset says a standalone card "keeps its props type"; bound both sentences to name that exception, or keepSelectableCardPropsunchanged through an owner-approved record change.
Everything else checks out locally: the unit tests and typechecks pass, the group's stories render pixel-identically before and after, and the first-load cost is +124 B. CI has not run on this draft yet.
Claims and files checked
Review mode: full; reason: requested
Claims (title, description, changeset):
- Title, a card joins its group by value: verified (
SelectableCard.tsx:533-556; unit tests). - A card with
valuein place ofisSelected/onChangeis a member; the group gives selection, a radio or checkbox input, the name and the disabled default; a radio only selects: verified (SelectableCard.tsx:533-556,679-704;SelectableCardRadio.test.tsx). - The Lab item and its props type are removed; the group provides one private context: verified (Lab
index.ts,SelectableCardGroup.tsx:233-235; no reference to the item remains in the repository). - The chosen, enabled radio card renders the hidden input that submits the group's value: verified (
SelectableCard.tsx:702-704; FormData test; two-forms story submits the same pairs before and after). - Membership stops at a layer, as the toggle-button group's does: verified (layer-scoped context; the layer content boundary in the shared layer hook and Dialog; layer test).
- The record describes the member case (DEC-1, Group value, FR1, FR2, FR5, AR1): verified (record diff).
- Lab reaches the reshaped context through Core's unchanged internal entry: verified (
internal/selectable-card.tsnot changed;selectableCardInput.ts); the follow-up pull request's removal of those exports: verified against its current files, which remove them under the context's older name. - The record amendment needs an engineering owner's approval: verified (approval recorded for this head).
- DEC-1 follows the toggle-button group member rule; invalid combinations are typed out; type changes are additive; layer membership follows the layer-boundary record: verified, except the additive bullet's consequence below.
- The public delta code block matches the shipped signatures: verified (
SelectableCard.tsx:333-417,469-504). - A standalone card keeps its props, and extending or omitting from the derived props type keeps working: false for a type that declares its own
value(TS2430, reproduced locally). - TypeScript rejects
isSelectedoronChangebesidevalue, and a card with neither: verified (Core typecheck with the test's expect-error cases, plus extra probes, run locally). - Outside a group, a card with
valueis unselected and inert (reads as disabled, no hover or press paint, ignores clicks and keys): verified (SelectableCard.tsx:535-542,630,653,663; test; story capture). - A member's own
isDisabledadds to the group's, and a disabled member submits nothing: verified (SelectableCard.tsx:542,688,702; tests). - Lab is canary-only; its children are now
SelectableCards: verified (Lab package is private and canary-only). - One new caller decision; in a group's DOM only the hidden input moves; no theming target, data attribute, token or string changes: verified (seven story pairs pixel-identical with identical inputs apart from that move; API delta has no theme rows).
- The new type name is approved with the record: verified.
- Rejected designs (union props, optional props): reported (design rationale).
- Core's output names no Lab surface (JSDoc, docs, changeset say "card group"; no development warning): verified (public declarations no longer name it).
- The group stays Lab-only until the follow-up: verified.
- Screenshots and pixel-identical states: reported; seven pairs reproduced pixel-identical locally.
- Unit test coverage list: verified (49 of 49 pass locally).
- Mutation results and Chromium spec coverage: reported (CI has not run on this draft).
- Preflight, test counts and checks at earlier heads: reported; tests and typechecks pass locally at this head.
- Maintainer fixes (two signatures, a stray card disabled, no warning, "card group" wording, context kept in its module, internal entry unchanged, context version 2, docs layout): verified.
- First-load size +121 B: reported; +124 B measured locally, under the 0.3 KB allowance.
ValueOutsideAGroupstory added; Group value row wording; owner approval at this head: verified.- Scope checklist (one capability, nothing unrelated, docs and tests ship, no internal context): verified.
- Writing rubric results: verified against the record.
- Changeset: member behavior, radio and checkbox inputs, new type,
value?: neverrejecting both, stray card inert: verified; "A standalone card keeps its props type": false for extending types that declarevalue(same finding).
Files:
.changeset/selectable-card-group-value.md: finding (compatibility sentence).apps/storybook/stories/SelectableCard.stories.tsx: clear.apps/storybook/stories/SelectableCardGroup.stories.tsx: clear.docs/specs/components/SelectableCard/SelectableCard.spec.md: clear (owner-approved).packages/cli/test/swizzle-proof/samples.mjs: clear.packages/core/src/SelectableCard/SelectableCard.doc.mjs: clear.packages/core/src/SelectableCard/SelectableCard.tsx: finding (value?: neverat line 399).packages/core/src/SelectableCard/SelectableCardRadio.test.tsx: clear.packages/core/src/SelectableCard/index.ts: clear.packages/core/src/SelectableCard/selectableCardInput.ts: clear.packages/lab/blocks/SelectableCardGroupShippingSpeed.doc.mjs: clear.packages/lab/blocks/SelectableCardGroupShippingSpeed.tsx: clear.packages/lab/blocks/SelectableCardGroupShowcase.doc.mjs: clear.packages/lab/blocks/SelectableCardGroupShowcase.tsx: clear.packages/lab/src/SelectableCardGroup/SelectableCardGroup.doc.mjs: clear.packages/lab/src/SelectableCardGroup/SelectableCardGroup.test.tsx: clear.packages/lab/src/SelectableCardGroup/SelectableCardGroup.tsx: clear.packages/lab/src/SelectableCardGroup/index.ts: clear.packages/lab/src/index.ts: clear.
| * Only a member of a card group takes a `value`, in place of | ||
| * `isSelected` and `onChange` (SelectableCardMemberProps). | ||
| */ | ||
| value?: never; |
There was a problem hiding this comment.
value?: never on the released interface breaks any consumer type that extends SelectableCardProps (or ComponentProps<typeof SelectableCard>) and declares its own value: interface PlanCardProps extends SelectableCardProps { value: string } compiles on the base and fails with TS2430 here, and Omit<SelectableCardProps, 'isSelected' | 'onChange'> & {value: string} collapses to never. Either bound the description's "keep working" sentence and the changeset's "keeps its props type" to name this, or keep SelectableCardProps unchanged and put value?: never only in the implementation's union. The overloads plus JSX's excess-property check already reject value beside isSelected, but that option changes the record's compatibility class, so it needs a new approval.
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [feat] `SelectableCard` takes `value`. A card with a `value` in place of `isSelected` and `onChange` is a member of the card group around it, and the group gives the card its selection, its input and its disabled default. In a single-choice group the card is a native radio that selects and never deselects itself; in a multiple-choice group it is a checkbox that submits its `value` under the group's name. The new `SelectableCardMemberProps` type describes a member. `SelectableCardProps` stays the interface it was and gains only `value?: never`, so TypeScript rejects `isSelected` or `onChange` beside `value`. Outside a group, a card with a `value` is unselected and inert: it reads as disabled and ignores clicks. A standalone card keeps its props type, DOM and behavior. |
There was a problem hiding this comment.
"A standalone card keeps its props type": a type that extends SelectableCardProps and declares its own value stops compiling after this patch (TS2430), because the interface gains value?: never. Suggested ending: "A standalone card keeps its DOM and behavior; a type that extends SelectableCardProps and declares its own value must rename it."
SelectableCardGroup to Core, two pull requests. Review and merge in this order; each is based on the one before it, and both should ship in the same release (see "Release order").
valueis a member of the SelectableCardGroup around it ← this pull requestUser need
A product that asks people to choose among a few rich options, such as a plan, a shipping speed or a layout, shows them as cards. For one choice, keyboard and screen-reader users need a radio group: one tab stop, the arrow keys, and the position spoken. Today that takes Lab's SelectableCardGroup and its own card component, SelectableCardGroupItem, which repeats every SelectableCard prop except
isSelectedandonChange. Core's SelectableCard cannot be one choice of a set at all: its record keeps single-select out of its public contract until the group is in Core.So a builder learns two card components for one job, and the group cannot move to Core while its cards are a second API for that job (
architecture:public-component-apiINV21, one API per job).Problem and solution fit
valueon SelectableCard. A card with avalue, in place ofisSelectedandonChange, is a member of the SelectableCardGroup around it. The group gives it its selection, its input (a radio in a single choice, a checkbox in several), its input name and its disabled default, and the card sends the group its selection requests. A radio only selects.htmlName. The item wrapper used to render it beside the card.valuein a popover or a dialog opened inside the group is not a member (spec:AST-038FR7, FR8), as ToggleButtonGroup's context already behaves.component:SelectableCarddescribes the member case: DEC-1 (a card joins a group byvalue), a Group value concept, and FR1, FR2, FR5 and AR1 for a radio member.selectable-cardentry, which keeps itsSelectableCardInputContextexport from the sameselectableCardInput.tsmodule; the context now carries each member's input, selection and disabled default. feat(core): SelectableCardGroup moves to Core #13734 removes the context exports andjoinAriaIDsfrom that entry when the group moves to Core; the entry keepsuseFieldInputStyling.Current specification
component:SelectableCard(current): its ownership boundary kept single-select out of the public contract "until the group is promoted to Core". This pull request amends it, so it needs an engineering owner's/approve-spec.component:SelectableCardDEC-1, added here: a member identified byvaluetakes its selection from its group, as a ToggleButtonGroup member does (family:buttonsFR11). Rejected: a separate item component that wraps the card.spec:AST-002FR15 (invalid states are prevented where practical): a card is typed as standalone or as a member, never both.spec:AST-017FR25 (outside a declared minor, type changes are additive):SelectableCardPropskeeps its members and gains onlyvalue?: never; the member shape is a new type. SelectableCard has two call signatures, the member one first, soComponentProps<typeof SelectableCard>staysSelectableCardProps.spec:AST-038FR7, FR8 (group membership stops at a layer boundary).Public delta and caller burden
Core:
SelectableCardPropsstays an interface, andComponentProps<typeof SelectableCard>staysSelectableCardProps, sointerface X extends ComponentProps<typeof SelectableCard>andOmit<ComponentProps<typeof SelectableCard>, …>keep working; a test pins both.isSelectedoronChangebesidevalue, and a card with neither.valuerenders unselected and inert: it is disabled, so it reads as disabled, shows no hover or press paint, and ignores clicks and keys.isDisabledadds to the group's: a disabled group disables every card, and an enabled group does not enable a card that disables itself. A disabled member submits nothing.Lab (canary only): SelectableCardGroup's children are SelectableCards, and
SelectableCardGroupItemandSelectableCardGroupItemPropsare removed.The caller's one new decision: give a card a
value(a member) orisSelectedandonChange(standalone). In a group's DOM, one thing moves: the hidden input that submits a single choice sits inside the chosen card, after its radio, instead of after the card. No theming target, data attribute, token or string changes.Owner decision in this pull request: the name of the new public type,
SelectableCardMemberProps. The record names it, so approving the record approves the name.Design and alternatives
SelectableCardPropsas a union of a standalone shape and a member shape. It would make invalid combinations unrepresentable with no new type name, but it turns a released interface into a union:interface X extends SelectableCardPropsstops compiling (TS2312), and so does passing anOmit<SelectableCardProps, …>back to the card. That is a breaking type change, whichspec:AST-017FR25 keeps out of a patch release.isSelectedandonChange, ignored inside a group, as ToggleButton ignoresisPressed. It makes required props optional for code that reads them, and it lets a broken combination type-check (spec:AST-002FR15).Release order
Core's output names no Lab surface (
spec:AST-017FR27): its JSDoc,SelectableCard.doc.mjsand the Changeset say "card group", and the card has no development warning that names one. SelectableCardGroup itself stays Lab-only until #13734.Evidence
Real-browser screenshots of the Lab/SelectableCardGroup stories, from a static Storybook build of main and of this branch, served locally and captured in headless Chromium at 2× scale, scoped to
#storybook-root.All 14 captured states are pixel-identical before and after (0 differing pixels). The others: chose Team, multiple, vertical, two forms, one
htmlName, dark, Y2K, right to left, 320 px wide. In every state each input's type, value, checked state, form owner andaria-disabledalso match before and after.SelectableCardRadio.test.tsx): radio and checkbox members, Enter and click on a chosen radio, group and member disabled (each blocks selection and form submission), the chosen card's form value, a card without avaluein a group, a card with avalueoutside a group, a card in a layer inside a group, and the props types (@ts-expect-errorfor "both" and "neither", andextendsandOmitonSelectableCardProps).@ts-expect-errorcases fail with optional props in place of the two types.SelectableCardGroupRadio.a11y.chromium.spec.ts): one tab stop, arrows that move and select with wrapping, Space, a click on the chosen card, and two groups that share anhtmlNamein separate forms. The SelectableCard states ofCheckbox.a11y.chromium.spec.ts,CardPress,FocusRingOwnerandReducedMotionPresspass unchanged.Scope
Components: SelectableCard, SelectableCardGroup
Writing rubric results
docs/specs/components/SelectableCard/SelectableCard.spec.md:SelectableCardRadio.test.tsx, SelectableCardGroup's tests and its Chromium spec), not changes.Testing
Local gates on the first version of this branch, over main at aee3fa9:
pnpm preflight --browser: review:pre (0 findings), build, typecheck of the changed packages and their dependents, ESLint and Prettier on the changed files,check:repo, Vitest ui (842 files, 21,246 tests) and node (1,782 files, 27,833 tests, including all 8 swizzle-proof slices: 182 targets, 0 failures),check:knowledge,check:changesets, the Storybook build, and the 133 accessibility-contract specs the change selects all pass. The change selects the full Chromium interaction suite (2,008 tests, one worker); 1,847 passed before the local run hit its time limit, and the remaining files (NavigationStack, PageControl, RefreshControl, TabBar, Tour) then passed on their own: 206 passed, 1 skipped by its spec, none failed. The last commit after that run only adds the new type to the file header's@outputline; strict ESLint and Prettier pass on it.pnpm exec vitest run packages/core/src/SelectableCard packages/lab/src/SelectableCardGroup: 41 passed.pnpm storybook:build, thenplaywright test --project=chromium SelectableCardGroupRadio: 4 passed; the SelectableCard states ofCheckbox.a11y.chromium.spec.ts,CardPress,FocusRingOwnerandReducedMotionPress: 70 passed.ASTRYX_STRICT_LINT=1 eslinton the changed files: 0 errors.pnpm review:pre: 0 findings.pnpm check:knowledge: aligned, with 27 status warnings against main's 29.A second agent session that did not write the change reviewed it against the pre-review checklist; its findings are fixed here (the props types, the R7 rows, a disabled checkbox member's form test, and the comments).
Rebased onto main at d63c249. The diff is unchanged (identical patch id), and
pnpm preflightpasses again on this head: review:pre (0 findings), build, typecheck, lint, Vitest ui and node (including all 8 swizzle-proof slices, 0 failures),check:knowledgeandcheck:changesets, ending "ready to flip".Rebased onto main at a92c1ce. Conflicts came up in two files only, the SelectableCard record and
SelectableCard.doc.mjs; the other 18 files' changes are unchanged (same per-file patch ids). Main has since made the card's target reflectdata-disabled, added the forced-colors selection ring, reworded the record's project-status phrases, and renamed thelabeldescription. The resolved record keeps all of that and adds this pull request's member wording: the Contract-at-a-glance rows, the compatibility class, the Selection, Disabled and Group value concepts, FR1, FR2, FR4 and FR5, the radio-member state, and the group verification row. The source reads the effective disabled state fordata-disabled, so a member of a disabled group carries it too, and FR5 says so. Thelabeldescription now also names the radio a single-choice member renders. Prettier re-aligned the record's tables. On this headpnpm preflightpasses: review:pre (0 findings), build, typecheck, lint, Vitest ui (21,829 tests) and node (28,234 tests, including all 8 swizzle-proof slices, 0 failures),check:knowledge(aligned, no warnings, as on main) andcheck:changesets, ending "ready to flip". The screenshots above predate this rebase.Main merge (c903d9b, a maintainer carry; the commit above is unchanged): in
docs/specs/components/SelectableCard/SelectableCard.spec.md, the verification map keeps main's rows, including its updated "FR2 (nested)" row, and adds this branch's "Group membership" row. No other change.Maintainer carry at d4f41c2 and 9a66a04 (Co-authored-by: @ernestt)
(Posted by Cindy's agent.) Six review fixes in one push; @ernestt's design and record approval are unchanged.
ComponentProps<typeof SelectableCard>was a union, sointerface X extends ComponentProps<typeof SelectableCard>and anOmitspread stopped compiling in a patch (spec:AST-017FR25). The last signature is the standalone interface again.valueoutside a group is disabledonClick, showed hover and press paint, and read as an enabled checkbox.spec:AST-017FR27).selectableCardInput.tsasSelectableCardInputContextarchitecture:knowledge-contractsDEC-22); Core'sinternal/selectable-cardentry is unchanged from main.createLayerScopedContextRed first, at c903d9b with the new tests: "a card with a value outside a group stays unselected and inert" fails (its
onClickruns, noaria-disabled), and Core's typecheck fails the extended-props test with TS2312. Both pass at d4f41c2.First-load size (the size report's
measureEntry, a page that importsSelectableCard): main b3411f8 18,010 B; c903d9b 18,339 B (+329 B); d4f41c2 18,131 B (+121 B, under the 307 B thatarchitecture:component-import-boundariesINV10 allows an opt-in feature).Checks at d4f41c2: SelectableCard and Lab SelectableCardGroup tests 49/49; Core, Lab and Storybook typechecks clean; strict eslint 0 errors; Prettier clean; swizzle-proof samples 24 passed;
pnpm check:knowledgealigned.Story:
Core/SelectableCardgainsValueOutsideAGroup, a standalone card beside a card with avalueand no group.Second carry round at 9a66a04
valuerenders unselected and disabled (FR5)." It no longer promises a development warning. Owner approval was renewed at this head.SelectableCard.doc.mjskeeps its original layout; only the six "card group" wordings differ from c903d9b.SelectableCardInputContextmoves to protocol version 2, because its value changed shape: a copy on the old shape never reads it.pnpm check:knowledgealigned.Real-Chrome stills at 9a66a04 (macOS Chrome, 1280×800, neutral theme)
A standalone card beside a card with a
valueand no group, which reads as disabled:The Disabled story for comparison, unchanged from main: