Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/promote-selectablecardgroup-to-core.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astryxdesign/core': patch
---

[feat] Promote `SelectableCardGroup` to Core, imported from `@astryxdesign/core/SelectableCardGroup` or the package root. SelectableCardGroup is a set of SelectableCards, each with a `value`, that has the semantics of its selection. One choice (`type="single"`, the default) is a radio group: the cards are native radios, so the set is one tab stop, the arrow keys move and select, screen readers speak the position ("2 of 3"), and the chosen card submits its value under `htmlName`. Several choices (`type="multiple"`) are a named group of checkboxes. The group takes a controlled `value` and `onChange`, a `label` and an optional `description` through Field, `isDisabled`, and `orientation`. As every component that composes Field does, it takes no root `xstyle`, `className`, or `style`: `containerXstyle`, `containerClassName`, and `containerStyle` style the Field box, and `controlXstyle`, `controlClassName`, and `controlStyle` style the group element that lays out the cards.
Comment thread
astracat-bot[bot] marked this conversation as resolved.
Resolved

@ernestt
7 changes: 7 additions & 0 deletions .changeset/selectablecardgroup-core-blocks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astryxdesign/cli': patch
---

[docs] `astryx template` lists SelectableCardGroup's blocks among Core's component blocks: the "Plan picker" showcase and the "Shipping speed" example, which import the group from `@astryxdesign/core`.

@ernestt
2 changes: 2 additions & 0 deletions apps/sandbox/scripts/next-export-routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,8 @@
"/templates/SegmentedControlShowcase/",
"/templates/SegmentedControlWithIcons/",
"/templates/SelectableCardElevated/",
"/templates/SelectableCardGroupShippingSpeed/",
"/templates/SelectableCardGroupShowcase/",
"/templates/SelectableCardMulti/",
"/templates/SelectableCardShowcase/",
"/templates/SelectorBottomSheet/",
Expand Down
4 changes: 2 additions & 2 deletions apps/storybook/stories/SelectableCardGroup.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {useState} from 'react';
import {Text} from '@astryxdesign/core/Text';
import {VStack} from '@astryxdesign/core/Layout';
import {SelectableCard} from '@astryxdesign/core/SelectableCard';
import {SelectableCardGroup} from '@astryxdesign/lab/SelectableCardGroup';
import {SelectableCardGroup} from '@astryxdesign/core/SelectableCardGroup';

const meta: Meta<typeof SelectableCardGroup> = {
title: 'Lab/SelectableCardGroup',
title: 'Core/SelectableCardGroup',
component: SelectableCardGroup,
tags: ['autodocs'],
parameters: {
Expand Down
17 changes: 8 additions & 9 deletions docs/specs/components/SelectableCard/SelectableCard.spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ verified_by:
packages/core/src/SelectableCard/SelectableCard.test.tsx,
packages/core/src/SelectableCard/__tests__/SelectableCardAudit.a11y.chromium.spec.ts,
packages/core/src/SelectableCard/SelectableCardRadio.test.tsx,
packages/lab/src/SelectableCardGroup/SelectableCardGroup.test.tsx,
packages/lab/src/SelectableCardGroup/__tests__/SelectableCardGroupRadio.a11y.chromium.spec.ts,
packages/core/src/SelectableCardGroup/SelectableCardGroup.test.tsx,
packages/core/src/SelectableCardGroup/__tests__/SelectableCardGroupRadio.a11y.chromium.spec.ts,
packages/core/src/theme/themingTargets.test.ts,
apps/storybook/stories/SelectableCard.stories.tsx,
scripts/check-knowledge.mjs,
Expand Down Expand Up @@ -63,7 +63,7 @@ SelectableCard turns a Card into one selectable option. On its own or in a
multiple-choice `SelectableCardGroup`, it is a checkbox; in a single-choice
group, it is a radio. It owns the hidden input's semantics, whole-surface
toggling, and the selection ring. The caller owns a standalone card's
selection; the group owns a member's.
selection; `component:SelectableCardGroup` owns a member's.

## Compatibility and migration

Expand Down Expand Up @@ -131,16 +131,15 @@ Consumer migration instructions belong in consumer docs and release notes.
selection, input type (`radio` in a `type="single"` group, `checkbox` in a
`type="multiple"` group), input name, and disabled default from the group,
and sending the group its selection requests. The group provides them
through a private context, which Lab's SelectableCardGroup reaches through
Core's `internal/selectable-card` entry; no public context is exported.
through a private context; no context is exported.

**Does not own / non-goals**

- Card surface paint, padding, radius, elevation, and sizing — owned by
`component:Card`.
- Group semantics, the group label, and which options are selected — owned by
SelectableCardGroup for members and by the product callsite for standalone
cards.
`component:SelectableCardGroup` for members and by the product callsite for
standalone cards.
- Navigation and one-shot actions — owned by `component:ClickableCard`.

## Public concepts
Expand Down Expand Up @@ -252,8 +251,8 @@ Consumer migration instructions belong in consumer docs and release notes.
- `architecture:component-theming-surface` sets the rules the
`selectable-card` target follows and requires a safe baseline for the
extensible `variant`, which `--selectable-card-ring-color` satisfies.
- SelectableCardGroup owns group semantics and selection for members
identified by `value`.
- `component:SelectableCardGroup` owns group semantics and selection for
members identified by `value`.
- `spec:AST-038` FR8 stops group membership at a layer boundary: a card with a
`value` in a layer opened inside a group is not a member.

Expand Down
Loading