diff --git a/.changeset/promote-selectablecardgroup-to-core.md b/.changeset/promote-selectablecardgroup-to-core.md new file mode 100644 index 0000000000000..30a778d118523 --- /dev/null +++ b/.changeset/promote-selectablecardgroup-to-core.md @@ -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`. Like RadioList and CheckboxList, 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. + +@ernestt diff --git a/.changeset/selectablecardgroup-core-blocks.md b/.changeset/selectablecardgroup-core-blocks.md new file mode 100644 index 0000000000000..a96f597d795ad --- /dev/null +++ b/.changeset/selectablecardgroup-core-blocks.md @@ -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 diff --git a/apps/sandbox/scripts/next-export-routes.json b/apps/sandbox/scripts/next-export-routes.json index 8d16421526162..345f760a1a4a7 100644 --- a/apps/sandbox/scripts/next-export-routes.json +++ b/apps/sandbox/scripts/next-export-routes.json @@ -536,6 +536,8 @@ "/templates/SegmentedControlShowcase/", "/templates/SegmentedControlWithIcons/", "/templates/SelectableCardElevated/", + "/templates/SelectableCardGroupShippingSpeed/", + "/templates/SelectableCardGroupShowcase/", "/templates/SelectableCardMulti/", "/templates/SelectableCardShowcase/", "/templates/SelectorBottomSheet/", diff --git a/apps/storybook/stories/SelectableCardGroup.stories.tsx b/apps/storybook/stories/SelectableCardGroup.stories.tsx index 52be7d843ad36..31567562eca4e 100644 --- a/apps/storybook/stories/SelectableCardGroup.stories.tsx +++ b/apps/storybook/stories/SelectableCardGroup.stories.tsx @@ -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 = { - title: 'Lab/SelectableCardGroup', + title: 'Core/SelectableCardGroup', component: SelectableCardGroup, tags: ['autodocs'], parameters: { diff --git a/docs/specs/components/SelectableCard/SelectableCard.spec.md b/docs/specs/components/SelectableCard/SelectableCard.spec.md index a56e735220187..dfd284d18dc2e 100644 --- a/docs/specs/components/SelectableCard/SelectableCard.spec.md +++ b/docs/specs/components/SelectableCard/SelectableCard.spec.md @@ -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, @@ -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 @@ -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 @@ -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. diff --git a/docs/specs/components/SelectableCardGroup/SelectableCardGroup.spec.md b/docs/specs/components/SelectableCardGroup/SelectableCardGroup.spec.md new file mode 100644 index 0000000000000..7147db5fe269a --- /dev/null +++ b/docs/specs/components/SelectableCardGroup/SelectableCardGroup.spec.md @@ -0,0 +1,212 @@ +--- +schema_version: 3 +template_version: 7 +kind: component +id: component:SelectableCardGroup +authority: draft +archive_reason: null +superseded_by: null +approved_by: null +approved_at: null +owners: [cixzhang] +review_triggers: [public-api, behavior, layout, theming, accessibility] +verified_by: + [ + packages/core/src/SelectableCardGroup/SelectableCardGroup.test.tsx, + packages/core/src/SelectableCardGroup/SelectableCardGroup.fr10.test.tsx, + packages/core/src/Field/fieldInputFamily.test.tsx, + packages/core/src/SelectableCardGroup/__tests__/SelectableCardGroupRadio.a11y.chromium.spec.ts, + packages/core/src/SelectableCard/SelectableCardRadio.test.tsx, + packages/lab/src/SelectableCardGroup/index.test.ts, + packages/core/src/theme/themingTargets.test.ts, + scripts/check-knowledge.mjs, + ] +modules: [] +families: [family:input-fields] +design_specs: [] +architecture: + [architecture:component-theming-surface, architecture:public-component-api] +contributing: [] +system_specs: [spec:AST-038, spec:AST-085] +--- + +# SelectableCardGroup component contract + + + +```json +{ + "paths": ["packages/lab/src/SelectableCardGroup/index.ts"] +} +``` + +## Contract at a glance + +| Area | Contract | +| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Public contract | `SelectableCardGroup` and `SelectableCardGroupProps` from `@astryxdesign/core`. Props: `label`, `type` (`single` or `multiple`), a controlled `value` and `onChange`, `isLabelHidden`, `description`, `htmlName`, `isDisabled`, `orientation`, `children`, a `ref`, and the `container*` and `control*` styling props. | +| Behavior | Its children are SelectableCards, each with a `value`. One choice is a Field-labelled `role="radiogroup"` of native radios: one tab stop, arrow keys that move and select, and a choice that never clears. Several choices are a labelled `role="group"` of checkboxes that toggle. | +| End-user impact | Keyboard and screen-reader users get the radio-group model for one choice, with its position spoken, and a named group of checkboxes for several. A disabled group's cards stay reachable by Tab and announce as unavailable. | +| Builder impact | Render SelectableCards with a `value` inside the group, and keep `value` in state. A Lab import reaches the Core component. | +| Compatibility/readiness | Additive Core export. The `@astryxdesign/lab` `SelectableCardGroup` and `SelectableCardGroupProps` exports re-export the Core ones (FR9). INV6 gap: the `selectable-card-group` target does not reflect the disabled state (FR1). | +| Review checks | Reject a single choice that is not one tab stop, a single choice that reports `null` or deselects its card, root styling props, a group without a name, or a card in a layer that joins the group. | +| Governing rules | `component:SelectableCard` DEC-1, FR1, FR2; `family:input-fields` FR10; `spec:AST-038` FR7, FR8; `spec:AST-085` FR1; `architecture:public-component-api` INV2, DEC-1 (`type`, the word ToggleButtonGroup uses); WAI-ARIA radio group pattern. | + +This table is a review projection; the body below is authoritative. + +## Intent + +SelectableCardGroup turns a set of SelectableCards into one form choice with +the semantics of its selection: a radio group for one choice and a group of +checkboxes for several. It owns the group's name and description, the +selection, the name the choice submits under, and the cards' layout. Each card +owns its own surface, input, and toggling (`component:SelectableCard`). +Consumer usage lives in `SelectableCardGroup.doc.mjs`. + +## Compatibility and migration + +- Released default preserved: not yet released in Core; the Lab component's + props keep their meaning and defaults +- Compatibility class: additive Core export; the Lab exports re-export the Core + ones (FR9) +- Controlled/uncontrolled behavior: controlled only; the group holds no + selection of its own +- Migration decision: none; a Lab import reaches the Core component (FR9) + +Consumer migration instructions belong in consumer docs and release notes. + +## Ownership boundary + +**Owns** + +- The Field label and description, and the group element: its role, name, + description, `aria-disabled`, layout, and the `selectable-card-group` target + (FR1, FR6). +- The selection: which members are selected, and the next `value` a member's + request produces (FR3, FR4). +- What each member reads from it: its selection, input type, input name, and + disabled default (FR2, FR5). +- The name the group's value submits under (FR3, FR4). + +**Does not own / non-goals** + +- Each card's surface, hidden input, ring, toggling, and how a member renders + what the group gives it — owned by `component:SelectableCard`. +- Label and description rendering — owned by `component:Field`. +- Requiring a choice, validation, and error messages — product callsite. +- Roving focus for several choices — not provided; each checkbox is a tab + stop. + +## Public concepts + +| Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior | +| ----------- | ----------------------------------------- | ---------------------------------------------------- | ----------------------------------------------- | ---------------- | ------------------------------- | --------- | ------------------------------------------------------------------------ | +| Type | `single`, `multiple` | One choice is a radio group; several are checkboxes. | Always; fixes the `value` and `onChange` shape. | `single` | `component:SelectableCardGroup` | Stable | TypeScript rejects a `value` or `onChange` that does not match the type. | +| Value | `string \| null`; `ReadonlyArray` | The selected members' values. | Always; required. | required | `component:SelectableCardGroup` | Stable | A value no member carries selects nothing visible. | +| Orientation | `horizontal`, `vertical` | Wrapping rows of cards, or one column. | Always. | `horizontal` | `component:SelectableCardGroup` | Stable | TypeScript rejects other values. | +| Disabled | off, on | Every member is disabled. | Always. | off | `component:SelectableCardGroup` | Stable | Not applicable. | +| Form name | a string | The name the group's value submits under in a form. | Always. | a generated name | `component:SelectableCardGroup` | Stable | Not applicable. | + +## Behavioral and layout contract + +Draft requirements identify their basis so observed code is not mistaken for an +intentional decision. A `current` contract contains no unresolved rows. + +| ID | Candidate invariant | Basis | Draft review state | +| --- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ------------------ | +| FR1 | The group renders `component:Field` with `label`, `description`, and `isLabelHidden` around one element with `role="radiogroup"` for `type="single"` and `role="group"` for `type="multiple"`. The label names the element and the description describes it, each joined with a caller's `aria-labelledby` and `aria-describedby`. The element carries the `selectable-card-group` target reflecting `orientation` and `type`. `architecture:component-theming-surface` INV6 gap: the target does not reflect the disabled state, so a theme cannot style a disabled group there. | Documented promise; WAI-ARIA radio group pattern; current source and tests | settled | +| FR2 | The members are the SelectableCards inside the group that carry a `value` (`component:SelectableCard` DEC-1). Each member reads from the group its selection, its input type (`radio` for `single`, `checkbox` for `multiple`), its input name, and its disabled default, and asks the group to change its selection. A card without a `value` is not a member. | `component:SelectableCard` DEC-1; current source and tests | settled | +| FR3 | Single: every member's radio carries one page-unique generated name and leaves the form, so the set is one tab stop where the arrow keys move and select, and two groups with the same `htmlName` stay apart. Activating an unselected member calls `onChange` with its value; activating the selected member changes nothing, so the group never reports `null`. The selected, enabled member submits its value under `htmlName`, else under a generated name. | Documented promise; current source, tests, and real-browser keyboard evidence | settled | +| FR4 | Multiple: activating an unselected member calls `onChange` with the current values and its value last; activating a selected member calls it with that value removed. Each checked, enabled member submits its value under `htmlName`, else under a generated name, and each member is its own tab stop. | Documented promise; current source and tests | settled | +| FR5 | `isDisabled` disables every member, which stays focusable with `aria-disabled="true"` (`spec:AST-085` FR1), and sets `aria-disabled="true"` on the group element. An enabled group does not enable a member that disables itself. A disabled member selects nothing and submits nothing. | `spec:AST-085` FR1; documented promise; current source and tests | settled | +| FR6 | The members sit in wrapping rows with the `--spacing-3` gap, or in one column when `orientation="vertical"`, in DOM order. | Documented promise; current source | settled | +| FR7 | The props type takes no root `xstyle`, `className`, or `style`; an untyped one is ignored and warns in development. `containerXstyle`, `containerClassName`, and `containerStyle` reach the Field box; `controlXstyle`, `controlClassName`, and `controlStyle` reach the group element after the group's own layout styles; and `ref`, DOM, and ARIA props reach the group element (`family:input-fields` FR10). | `family:input-fields` FR10; current source and tests | settled | +| FR8 | Membership stops at a layer boundary: a card with a `value` in a layer opened inside the group is not a member (`spec:AST-038` FR7, FR8). | `spec:AST-038` FR7, FR8; current source and tests | settled | +| FR9 | The `@astryxdesign/lab` `SelectableCardGroup` and `SelectableCardGroupProps` exports re-export the Core ones, so a Lab import renders the Core component and takes the Core props. | Current source and tests | settled | + +### Allowed variation + +- **AV1 — Card content.** Each member's content and its Card props vary; the + group places the cards and never inspects their content. + +### Representative states + +| State | Required invariant | Allowed variation | +| -------------------------- | ----------------------------------------------------------------------------- | ----------------- | +| Single, none chosen | Every radio unchecked; Tab lands on the first card. | Orientation. | +| Single, one chosen | That radio checked and the one tab stop; activating it again changes nothing. | — | +| Multiple, some chosen | Each chosen checkbox checked; activation adds or removes one value. | — | +| Member disabled | That card focusable and inert; it submits nothing; others selectable. | — | +| Group disabled | Every card focusable and inert; the group element has `aria-disabled="true"`. | — | +| Two groups, one `htmlName` | Each form submits its own choice; the arrow keys stay inside each group. | — | + +### Transformation and precedence order + +- **ORD1 — Member selection.** For a member, the group's `value`; a card's own + `isSelected` and `onChange` are a type error beside `value`. +- **ORD2 — Member disabled.** The group disabled or the member disabled. +- **ORD3 — Submitted name.** `htmlName`, then a generated name. + +### Performance and resources + +- **PR1 — No resource of its own.** The group adds no listener, observer, or + timer; the native radio group provides the keyboard model. + +Current measurements belong in the audit record; this subsection owns only +durable constraints and their verification target. + +## Accessibility contract + +- **AR1 — One choice is a native radio group.** The members' radios share one + name, so the set is one tab stop on the checked radio, or on the first when + none is checked; the arrow keys move and select with wrapping, and screen + readers speak each card's position (WAI-ARIA radio group pattern). +- **AR2 — The group is named and described.** The Field label names the group + element and the description describes it, also when the label is visually + hidden (FR1). +- **AR3 — Disabled stays discoverable.** A disabled group or member keeps every + tab stop and announces as unavailable (`spec:AST-085` FR1). + +## Design relationships + +| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract | +| --------------------------- | ----------------------------------------------- | ------------------------ | -------------- | ------------------ | +| Group label and description | Field's label and helper text above the cards. | `component:Field` | Supporting | FR1 | +| Cards | SelectableCards in wrapping rows or one column. | Current source and docs | Prominent | FR2, FR6 | + +## Family and system relationships + +- `component:SelectableCard` owns each card's surface, input, and toggling, and + how a member renders what the group gives it (DEC-1, FR1, FR2, FR5). +- `family:input-fields` FR10 sets how a component that composes Field takes + base props and styling; the group follows it as RadioList and CheckboxList + do. +- `spec:AST-038` FR7 and FR8 stop the group's membership at a layer boundary. +- `spec:AST-085` FR1 keeps disabled cards focusable. + +## Verification map + +| Contract | Verification | Representative states | Mutation or failure expectation | Audit section | +| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ | +| FR1, AR2 | `SelectableCardGroup.test.tsx` role, name, description, caller ARIA, and `data-type` cases | Single and multiple; with a description; a caller's `aria-labelledby` | A group without its role or name, a lost caller id, or a target that stops reflecting `type` fails. | `audit:SelectableCardGroup/a11y` | +| FR2, FR8 | `SelectableCardRadio.test.tsx` membership, standalone-card, and layer cases | A member; a card without a `value`; a card with a `value` in a layer inside a group | A card without a `value` that joins, or a card in a layer that joins, fails. | `audit:SelectableCardGroup/behavior` | +| FR3, AR1 | `SelectableCardGroup.test.tsx` single-choice and form cases; `SelectableCardGroupRadio.a11y.chromium.spec.ts` keyboard cases | None and one chosen; Tab, Shift+Tab, arrows, Space, a click on the chosen card; two forms | A second tab stop, an arrow that does not select or wrap, a `null` report, or a form that submits another group's choice fails. | `audit:SelectableCardGroup/a11y` | +| FR4 | `SelectableCardGroup.test.tsx` multiple-choice case; `SelectableCardRadio.test.tsx` checkbox-member case | Some chosen; add and remove | A wrong next list, or a checked member that does not submit its value, fails. | `audit:SelectableCardGroup/behavior` | +| FR5, AR3 | `SelectableCardGroup.test.tsx` disabled-group, member-disabled, and form cases; `SelectableCardRadio.test.tsx` disabled cases | Group disabled; one member disabled | A selection while disabled, a disabled card that submits or leaves the tab order, or a group that enables a disabled member fails. | `audit:SelectableCardGroup/a11y` | +| FR6 | `SelectableCardGroup.stories.tsx` horizontal and vertical stories; real-browser evidence | Horizontal and vertical | Gap: no automated check of the gap or the wrapping. | `audit:SelectableCardGroup/design` | +| FR7 | `SelectableCardGroup.test.tsx` root-styling and container cases; `SelectableCardGroup.fr10.test.tsx`, the shared input-fields FR10 suite; `fieldInputFamily.test.tsx` coverage | An untyped `className`; `container*` and `control*`; a caller `ref`, `id`, `data-*`, and `aria-describedby`; a horizontal-labels FormLayout | A root styling prop that reaches the group element, a `container*` prop that misses the Field box, a `control*` prop that misses the group element, or base props that miss the group element fail. | `audit:SelectableCardGroup/api` | +| FR9 | Lab `index.test.ts` identity and props-type cases | Lab imports | A Lab export that is not the Core component, or Lab props that differ from the Core props, fail. | `audit:SelectableCardGroup/api` | + +## Decision log + +None recorded. + +## Open questions + +None. + +## Content boundary + +This file does not duplicate consumer prop tables or examples, SelectableCard's +card rules, Field's label rules, or family and system rules. It links to their +owners. diff --git a/internal/shadcn-registry/routes.lock.json b/internal/shadcn-registry/routes.lock.json index 60ce1aa074a1f..fad372337346a 100644 --- a/internal/shadcn-registry/routes.lock.json +++ b/internal/shadcn-registry/routes.lock.json @@ -722,11 +722,6 @@ "path": "components/lab/schedule", "aliases": [] }, - { - "name": "component-lab-selectable-card-group", - "path": "components/lab/selectable-card-group", - "aliases": [] - }, { "name": "component-lab-stat", "path": "components/lab/stat", @@ -1019,6 +1014,13 @@ "path": "components/selectable-card", "aliases": [] }, + { + "name": "component-selectable-card-group", + "path": "components/selectable-card-group", + "aliases": [ + "components/lab/selectable-card-group" + ] + }, { "name": "component-selector", "path": "components/selector", diff --git a/packages/lab/blocks/SelectableCardGroupShippingSpeed.doc.mjs b/packages/cli/assets/templates/blocks/components/SelectableCardGroup/SelectableCardGroupShippingSpeed.doc.mjs similarity index 85% rename from packages/lab/blocks/SelectableCardGroupShippingSpeed.doc.mjs rename to packages/cli/assets/templates/blocks/components/SelectableCardGroup/SelectableCardGroupShippingSpeed.doc.mjs index 1e5faef5dfe0d..1f173566d64b3 100644 --- a/packages/lab/blocks/SelectableCardGroupShippingSpeed.doc.mjs +++ b/packages/cli/assets/templates/blocks/components/SelectableCardGroup/SelectableCardGroupShippingSpeed.doc.mjs @@ -1,12 +1,12 @@ // Copyright (c) Meta Platforms, Inc. and affiliates. /** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */ -export default { +export const doc = { type: 'block', name: 'Shipping speed', displayName: 'Shipping speed', description: - 'A vertical group of full-width cards for options that need a line of detail: each speed shows its delivery time and its price. Stack the cards when their content reads as a row.', + 'A vertical group of full-width cards for options that need a line of detail: each speed shows its delivery time and its price. Put the cards in one column when their content reads as a row.', exampleFor: 'SelectableCardGroup', isReady: true, aspectRatio: 4 / 3, diff --git a/packages/lab/blocks/SelectableCardGroupShippingSpeed.tsx b/packages/cli/assets/templates/blocks/components/SelectableCardGroup/SelectableCardGroupShippingSpeed.tsx similarity index 92% rename from packages/lab/blocks/SelectableCardGroupShippingSpeed.tsx rename to packages/cli/assets/templates/blocks/components/SelectableCardGroup/SelectableCardGroupShippingSpeed.tsx index b2eaeaf043bf4..fec9eb44b35b6 100644 --- a/packages/lab/blocks/SelectableCardGroupShippingSpeed.tsx +++ b/packages/cli/assets/templates/blocks/components/SelectableCardGroup/SelectableCardGroupShippingSpeed.tsx @@ -5,12 +5,12 @@ /** * @input Three shipping speeds, each with its delivery time and price * @output A vertical SelectableCardGroup whose cards carry a description - * @position Lab SelectableCardGroup's docsite example and copyable CLI block + * @position SelectableCardGroup's docsite example and copyable CLI block */ import {useState} from 'react'; -import {SelectableCardGroup} from '@astryxdesign/lab'; import {SelectableCard} from '@astryxdesign/core/SelectableCard'; +import {SelectableCardGroup} from '@astryxdesign/core/SelectableCardGroup'; import {HStack, StackItem, VStack} from '@astryxdesign/core/Stack'; import {Text} from '@astryxdesign/core/Text'; diff --git a/packages/lab/blocks/SelectableCardGroupShowcase.doc.mjs b/packages/cli/assets/templates/blocks/components/SelectableCardGroup/SelectableCardGroupShowcase.doc.mjs similarity index 96% rename from packages/lab/blocks/SelectableCardGroupShowcase.doc.mjs rename to packages/cli/assets/templates/blocks/components/SelectableCardGroup/SelectableCardGroupShowcase.doc.mjs index f71de88b71c5a..a4bac7b4228a9 100644 --- a/packages/lab/blocks/SelectableCardGroupShowcase.doc.mjs +++ b/packages/cli/assets/templates/blocks/components/SelectableCardGroup/SelectableCardGroupShowcase.doc.mjs @@ -1,7 +1,7 @@ // Copyright (c) Meta Platforms, Inc. and affiliates. /** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */ -export default { +export const doc = { type: 'block', name: 'Plan picker', displayName: 'Plan picker', diff --git a/packages/lab/blocks/SelectableCardGroupShowcase.tsx b/packages/cli/assets/templates/blocks/components/SelectableCardGroup/SelectableCardGroupShowcase.tsx similarity index 90% rename from packages/lab/blocks/SelectableCardGroupShowcase.tsx rename to packages/cli/assets/templates/blocks/components/SelectableCardGroup/SelectableCardGroupShowcase.tsx index 644567e4ae7c6..6651570512b78 100644 --- a/packages/lab/blocks/SelectableCardGroupShowcase.tsx +++ b/packages/cli/assets/templates/blocks/components/SelectableCardGroup/SelectableCardGroupShowcase.tsx @@ -5,12 +5,12 @@ /** * @input Three plans, one chosen at a time * @output A SelectableCardGroup of plan cards: a radio group with one tab stop - * @position Lab SelectableCardGroup's docsite showcase and copyable CLI block + * @position SelectableCardGroup's docsite showcase and copyable CLI block */ import {useState} from 'react'; -import {SelectableCardGroup} from '@astryxdesign/lab'; import {SelectableCard} from '@astryxdesign/core/SelectableCard'; +import {SelectableCardGroup} from '@astryxdesign/core/SelectableCardGroup'; import {VStack} from '@astryxdesign/core/Stack'; import {Text} from '@astryxdesign/core/Text'; diff --git a/packages/cli/test/swizzle-proof/samples.mjs b/packages/cli/test/swizzle-proof/samples.mjs index 41d52f3cec3fd..b7f15c6a2354e 100644 --- a/packages/cli/test/swizzle-proof/samples.mjs +++ b/packages/cli/test/swizzle-proof/samples.mjs @@ -204,6 +204,15 @@ export const samples = { isSelected: false, onChange: noop, }), + core__SelectableCardGroup: ({C, React, mod, Pkg}) => { + const Card = mod.SelectableCard ?? Pkg.SelectableCard; + return React.createElement( + C, + {label: 'Plan', value: 'pro', onChange: noop}, + React.createElement(Card, {value: 'basic', label: 'Basic'}), + React.createElement(Card, {value: 'pro', label: 'Pro'}), + ); + }, core__Toast: ({C, React}) => React.createElement(C, {body: 'Changes saved', onDismiss: noop}), core__Toolbar: ({C, React, Core}) => @@ -785,16 +794,6 @@ export const samples = { {maxLines: 2}, 'A long paragraph that runs past two lines, so the clamp cuts it short and shows the rest only when it is expanded by the reader.', ), - lab__SelectableCardGroup: ({C, React, Core}) => - React.createElement( - C, - {label: 'Plan', value: 'pro', onChange: noop}, - React.createElement(Core.SelectableCard, { - value: 'basic', - label: 'Basic', - }), - React.createElement(Core.SelectableCard, {value: 'pro', label: 'Pro'}), - ), lab__Stat: ({C, React}) => React.createElement(C, {label: 'Revenue', value: '$12.4k'}), lab__TabBar: ({C, React, mod, Pkg}) => { diff --git a/packages/core/package.json b/packages/core/package.json index 4d435d32f6535..7cc49a9807b1e 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -554,6 +554,11 @@ "types": "./dist/SelectableCard/index.d.ts", "default": "./dist/SelectableCard/index.js" }, + "./SelectableCardGroup": { + "source": "./src/SelectableCardGroup/index.ts", + "types": "./dist/SelectableCardGroup/index.d.ts", + "default": "./dist/SelectableCardGroup/index.js" + }, "./Selector": { "source": "./src/Selector/index.ts", "types": "./dist/Selector/index.d.ts", diff --git a/packages/core/src/SelectableCard/selectableCardGroupContext.ts b/packages/core/src/SelectableCard/selectableCardGroupContext.ts index c0d9bc5f00585..5f5e7e973bf37 100644 --- a/packages/core/src/SelectableCard/selectableCardGroupContext.ts +++ b/packages/core/src/SelectableCard/selectableCardGroupContext.ts @@ -7,8 +7,8 @@ * @input The selection, input and disabled state of a group of cards * @output SelectableCardGroupContext: what a group gives each SelectableCard * that its `value` makes a member - * @position Internal: Lab's SelectableCardGroup provides it through - * `@astryxdesign/core/internal/selectable-card`. It is not public API. + * @position Private: SelectableCardGroup provides it to its cards. It is not + * public API. */ import {createLayerScopedContext} from '../Layer/layerScopedContext'; diff --git a/packages/lab/src/SelectableCardGroup/SelectableCardGroup.doc.mjs b/packages/core/src/SelectableCardGroup/SelectableCardGroup.doc.mjs similarity index 71% rename from packages/lab/src/SelectableCardGroup/SelectableCardGroup.doc.mjs rename to packages/core/src/SelectableCardGroup/SelectableCardGroup.doc.mjs index 77b0b30fb0d10..7609169377947 100644 --- a/packages/lab/src/SelectableCardGroup/SelectableCardGroup.doc.mjs +++ b/packages/core/src/SelectableCardGroup/SelectableCardGroup.doc.mjs @@ -4,6 +4,8 @@ export const docs = { name: 'SelectableCardGroup', displayName: 'Selectable Card Group', + // Keeps the registry route SelectableCardGroup had as a canary-only Lab component. + registry: {aliases: ['lab/selectable-card-group']}, category: 'Form Controls', keywords: [ 'card', @@ -103,6 +105,23 @@ export const docs = { description: 'Inline styles for the Field box. Same targeting as containerXstyle.', }, + { + name: 'controlXstyle', + type: 'StyleXStyles', + description: + 'StyleX styles for the group element (role="radiogroup" or role="group") that lays out the cards. Never a card or its input.', + }, + { + name: 'controlClassName', + type: 'string', + description: 'Class name for the group element that lays out the cards.', + }, + { + name: 'controlStyle', + type: 'CSSProperties', + description: + 'Inline styles for the group element that lays out the cards.', + }, ], theming: { targets: [ @@ -225,6 +244,22 @@ export const docsZh = { type: 'CSSProperties', description: 'Field 容器的内联样式,作用范围与 containerXstyle 相同。', }, + { + name: 'controlXstyle', + type: 'StyleXStyles', + description: + '作用于排列卡片的组元素(role="radiogroup" 或 role="group")的 StyleX 样式。从不作用于卡片或其输入控件。', + }, + { + name: 'controlClassName', + type: 'string', + description: '排列卡片的组元素的类名。', + }, + { + name: 'controlStyle', + type: 'CSSProperties', + description: '排列卡片的组元素的内联样式。', + }, ], theming: { targets: [ @@ -260,3 +295,54 @@ export const docsZh = { ], }, }; + +/** @type {import('@astryxdesign/cli/authoring').ComponentTranslationDoc} */ +export const docsDense = { + description: + 'Set of selectable cards w/ the semantics of its selection: one choice = radio group (one tab stop, arrow keys, position spoken); several = named group of checkboxes. Its cards are SelectableCards, each w/ a `value`.', + usage: { + description: + 'Choice among a few rich options shown as cards: plan, appearance, layout. One choice gets the radio-group keyboard; use `multiple` when several cards can be on.', + bestPractices: [ + { + guidance: true, + description: + 'Give every card a `label` that names its option; screen readers speak it.', + }, + { + guidance: true, + description: + 'Start a single choice w/ a value when there is a sensible default, so Tab lands on it.', + }, + { + guidance: false, + description: + 'Put buttons or links inside the cards; the whole card is the radio or checkbox target.', + }, + { + guidance: false, + description: 'Use for navigation or actions; use ClickableCard.', + }, + ], + }, + propDescriptions: { + label: "group's visible label and accessible name", + type: "'single' (radio group, default) | 'multiple' (checkboxes)", + value: 'chosen value (single, null while none) or values (multiple)', + onChange: 'called w/ the chosen value (single) or the new list (multiple)', + isLabelHidden: 'hides the label visually; it still names the group', + description: 'helper text under the label, linked to the group', + htmlName: 'name the value submits under; default: generated', + isDisabled: 'disables every card; they stay focusable', + orientation: "'horizontal' (wrapping rows, default) | 'vertical'", + children: 'SelectableCards, each w/ a `value`', + containerXstyle: + 'StyleX styles for the Field box; no root xstyle/className/style', + containerClassName: 'class name for the Field box', + containerStyle: 'inline styles for the Field box', + controlXstyle: + 'StyleX styles for the group element that lays out the cards', + controlClassName: 'class name for the group element', + controlStyle: 'inline styles for the group element', + }, +}; diff --git a/packages/core/src/SelectableCardGroup/SelectableCardGroup.fr10.test.tsx b/packages/core/src/SelectableCardGroup/SelectableCardGroup.fr10.test.tsx new file mode 100644 index 0000000000000..1c21649cd6549 --- /dev/null +++ b/packages/core/src/SelectableCardGroup/SelectableCardGroup.fr10.test.tsx @@ -0,0 +1,41 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. + +/** + * @file SelectableCardGroup.fr10.test.tsx + * @input Uses SelectableCardGroup, SelectableCard and the shared FR10 helpers + * @output Tests that base props, container* and control* reach their parts + * @position The group composes Field, so the input-fields family's styling + * and prop-routing rules hold for it as for RadioList and CheckboxList. + */ + +import {describe, it} from 'vitest'; +import {screen} from '@testing-library/react'; +import {expectFieldInputProps} from '../Field/fieldInputFamily.testing'; +import {describeFieldInputParts} from '../Field/fieldInputFamily.render-testing'; +import {SelectableCard} from '../SelectableCard/SelectableCard'; +import { + SelectableCardGroup, + type SelectableCardGroupProps, +} from './SelectableCardGroup'; + +describe('SelectableCardGroup props type (family:input-fields FR10)', () => { + it('accepts container* and control* and no root styling', () => { + expectFieldInputProps(); + }); +}); + +describeFieldInputParts('SelectableCardGroup', { + renderMember: props => ( + {}} + {...props}> + + Basic + + + ), + getControl: () => screen.getByRole('radiogroup'), + inGroup: false, +}); diff --git a/packages/lab/src/SelectableCardGroup/SelectableCardGroup.test.tsx b/packages/core/src/SelectableCardGroup/SelectableCardGroup.test.tsx similarity index 98% rename from packages/lab/src/SelectableCardGroup/SelectableCardGroup.test.tsx rename to packages/core/src/SelectableCardGroup/SelectableCardGroup.test.tsx index 2f78508c57873..8b55bfe038a84 100644 --- a/packages/lab/src/SelectableCardGroup/SelectableCardGroup.test.tsx +++ b/packages/core/src/SelectableCardGroup/SelectableCardGroup.test.tsx @@ -2,7 +2,7 @@ /** * @file SelectableCardGroup.test.tsx - * @input Uses SelectableCardGroup, core SelectableCard, Testing Library + * @input Uses SelectableCardGroup, SelectableCard, Testing Library * @output Tests the group's semantics and selection * @position A single choice is a radio group of native radios sharing a name; * several choices are a named group of checkboxes. @@ -11,7 +11,7 @@ import {useState} from 'react'; import {describe, it, expect, vi} from 'vitest'; import {render, screen, fireEvent} from '@testing-library/react'; -import {SelectableCard} from '@astryxdesign/core/SelectableCard'; +import {SelectableCard} from '../SelectableCard/SelectableCard'; import {SelectableCardGroup} from './SelectableCardGroup'; const PLANS = ['Basic', 'Pro', 'Team']; diff --git a/packages/lab/src/SelectableCardGroup/SelectableCardGroup.tsx b/packages/core/src/SelectableCardGroup/SelectableCardGroup.tsx similarity index 83% rename from packages/lab/src/SelectableCardGroup/SelectableCardGroup.tsx rename to packages/core/src/SelectableCardGroup/SelectableCardGroup.tsx index 4d47dd4d82282..8d26bbb369b19 100644 --- a/packages/lab/src/SelectableCardGroup/SelectableCardGroup.tsx +++ b/packages/core/src/SelectableCardGroup/SelectableCardGroup.tsx @@ -4,30 +4,35 @@ /** * @file SelectableCardGroup.tsx - * @input Uses Core's internal SelectableCardGroupContext (read by each core - * SelectableCard with a `value`), Field (the group label and description), - * useFieldInputStyling, useId, StyleX and the spacing tokens + * @input Uses SelectableCardGroupContext (read by each SelectableCard with a + * `value`), Field (the group label and description), useFieldInputStyling, + * useId, StyleX and the spacing tokens * @output Exports SelectableCardGroup and its props - * @position Lab: a set of selectable cards with the semantics of its selection + * @position A set of selectable cards with the semantics of its selection * * SYNC: When modified, update these files to stay in sync: * - ./SelectableCardGroup.doc.mjs (props, usage) * - ./index.ts (exports) * - /apps/storybook/stories/SelectableCardGroup.stories.tsx (stories) + * - /packages/cli/assets/templates/blocks/components/SelectableCardGroup/ (blocks) */ import {useId, useMemo, type ReactNode, type Ref} from 'react'; import * as stylex from '@stylexjs/stylex'; -import type {BaseProps} from '@astryxdesign/core'; -import {Field, type FieldContainerStyleProps} from '@astryxdesign/core/Field'; +import type {BaseProps} from '../BaseProps'; +import {Field} from '../Field/Field'; import { - SelectableCardGroupContext, - joinAriaIDs, useFieldInputStyling, + type FieldPartStyleProps, +} from '../Field/fieldParts'; +import { + SelectableCardGroupContext, type SelectableCardGroupMembership, -} from '@astryxdesign/core/internal/selectable-card'; -import {spacingVars} from '@astryxdesign/core/theme/tokens.stylex'; -import {mergeProps, themeProps} from '@astryxdesign/core/utils'; +} from '../SelectableCard/selectableCardGroupContext'; +import {spacingVars} from '../theme/tokens.stylex'; +import {joinAriaIDs} from '../utils/inputAria'; +import {mergeProps} from '../utils/mergeProps'; +import {themeProps} from '../utils/themeProps'; const styles = stylex.create({ group: { @@ -67,13 +72,13 @@ interface MultipleSelection { onChange: (value: string[]) => void; } -// It composes Field: root styling goes to the Field box through `container*` -// (the input-fields family), not onto the group. +// It composes Field, so it takes no root styling: `container*` styles the +// Field box and `control*` the group element (the input-fields family). export type SelectableCardGroupProps = Omit< BaseProps, 'onChange' | 'xstyle' | 'className' | 'style' > & - FieldContainerStyleProps & + FieldPartStyleProps & (SingleSelection | MultipleSelection) & { /** Ref forwarded to the group element (role radiogroup or group). */ ref?: Ref; @@ -131,11 +136,15 @@ export function SelectableCardGroup(props: SelectableCardGroupProps) { containerXstyle, containerClassName, containerStyle, + controlXstyle, + controlClassName, + controlStyle, type: _type, value: _value, onChange: _onChange, ...rest } = props; + const {type, value, onChange} = props; const labelID = useId(); const inputID = useId(); const descriptionID = useId(); @@ -150,20 +159,16 @@ export function SelectableCardGroup(props: SelectableCardGroupProps) { 'aria-labelledby': callerLabelledBy, 'aria-describedby': callerDescribedBy, ...otherGroupProps - } = groupProps as typeof groupProps & { - 'aria-labelledby'?: string; - 'aria-describedby'?: string; - }; + } = groupProps; const labelledBy = joinAriaIDs(labelID, callerLabelledBy); const describedBy = joinAriaIDs( description ? descriptionID : undefined, callerDescribedBy, ); - const isMultiple = props.type === 'multiple'; + const isMultiple = type === 'multiple'; const membership = useMemo(() => { - if (props.type === 'multiple') { - const {value, onChange} = props; + if (type === 'multiple') { return { inputType: 'checkbox', inputName: submitName, @@ -178,7 +183,6 @@ export function SelectableCardGroup(props: SelectableCardGroupProps) { ), }; } - const {value, onChange} = props; // The radios leave the form, so a page-unique name keeps each group // apart, even from another form's group with the same `htmlName`. return { @@ -193,14 +197,7 @@ export function SelectableCardGroup(props: SelectableCardGroupProps) { } }, }; - }, [ - props.type, - props.value, - props.onChange, - generatedName, - submitName, - isDisabled, - ]); + }, [type, value, onChange, generatedName, submitName, isDisabled]); return ( {children} diff --git a/packages/lab/src/SelectableCardGroup/__tests__/SelectableCardGroupRadio.a11y.chromium.spec.ts b/packages/core/src/SelectableCardGroup/__tests__/SelectableCardGroupRadio.a11y.chromium.spec.ts similarity index 82% rename from packages/lab/src/SelectableCardGroup/__tests__/SelectableCardGroupRadio.a11y.chromium.spec.ts rename to packages/core/src/SelectableCardGroup/__tests__/SelectableCardGroupRadio.a11y.chromium.spec.ts index bcace6fb6843f..493de66435a04 100644 --- a/packages/lab/src/SelectableCardGroup/__tests__/SelectableCardGroupRadio.a11y.chromium.spec.ts +++ b/packages/core/src/SelectableCardGroup/__tests__/SelectableCardGroupRadio.a11y.chromium.spec.ts @@ -27,7 +27,7 @@ test.afterAll(async () => { await storybook?.close(); }); -const STORY = 'lab-selectablecardgroup--single-choice'; +const STORY = 'core-selectablecardgroup--single-choice'; async function open(page: Page): Promise { await page.goto( @@ -84,6 +84,24 @@ test.describe('SelectableCardGroup, single choice', () => { expect(await checkedName(page)).toBe('Team'); }); + test('with none chosen, Tab lands on the first card and checks nothing', async ({ + page, + }) => { + await page.goto( + `${storybook.origin}/iframe.html?id=core-selectablecardgroup--vertical&viewMode=story`, + {waitUntil: 'load'}, + ); + await page.getByRole('radiogroup', {name: 'Plan'}).waitFor(); + const checked = page.locator('#storybook-root input[type="radio"]:checked'); + await expect(checked).toHaveCount(0); + await page.keyboard.press('Tab'); + expect(await focusedName(page)).toBe('Basic'); + await expect(checked).toHaveCount(0); + await page.keyboard.press('ArrowDown'); + expect(await focusedName(page)).toBe('Pro'); + expect(await checkedName(page)).toBe('Pro'); + }); + test('Space selects the focused card; a click on the chosen card keeps it', async ({ page, }) => { @@ -102,7 +120,7 @@ test('two groups that share an htmlName in separate forms stay separate', async page, }) => { await page.goto( - `${storybook.origin}/iframe.html?id=lab-selectablecardgroup--two-forms-shared-name&viewMode=story`, + `${storybook.origin}/iframe.html?id=core-selectablecardgroup--two-forms-shared-name&viewMode=story`, {waitUntil: 'load'}, ); await page.getByRole('radiogroup', {name: 'Second plan'}).waitFor(); @@ -116,7 +134,7 @@ test('two groups that share an htmlName in separate forms stay separate', async const submitted = await page.evaluate(() => Array.from(document.querySelectorAll('form')).map(form => Array.from(new FormData(form).entries()).map( - ([k, v]) => `${k}=${String(v)}`, + ([k, v]) => `${k}=${typeof v === 'string' ? v : v.name}`, ), ), ); diff --git a/packages/core/src/SelectableCardGroup/index.ts b/packages/core/src/SelectableCardGroup/index.ts new file mode 100644 index 0000000000000..1fcde27a0e445 --- /dev/null +++ b/packages/core/src/SelectableCardGroup/index.ts @@ -0,0 +1,13 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. + +/** + * @file index.ts + * @input Imports from SelectableCardGroup.tsx + * @output Exports SelectableCardGroup and SelectableCardGroupProps + * @position Component entry point; re-exported by /packages/core/src/index.ts + * + * SYNC: When modified, update /packages/core/src/SelectableCardGroup/SelectableCardGroup.doc.mjs + */ + +export {SelectableCardGroup} from './SelectableCardGroup'; +export type {SelectableCardGroupProps} from './SelectableCardGroup'; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 74a696f2ffcfe..82556c93a5e29 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -67,6 +67,7 @@ export * from './Grid'; export * from './Section'; export * from './SegmentedControl'; export * from './SelectableCard'; +export * from './SelectableCardGroup'; export * from './Selector'; export * from './MultiSelector'; export * from './Icon'; diff --git a/packages/core/src/internal/selectable-card.ts b/packages/core/src/internal/selectable-card.ts index 16a24e0902749..9ba7a2d1631a2 100644 --- a/packages/core/src/internal/selectable-card.ts +++ b/packages/core/src/internal/selectable-card.ts @@ -1,21 +1,15 @@ // Copyright (c) Meta Platforms, Inc. and affiliates. /** * @file selectable-card.ts - * @input SelectableCard's internal group context, the Field input styling - * rule and the aria id joiner - * @output `@astryxdesign/core/internal/selectable-card`: - * SelectableCardGroupContext, useFieldInputStyling and joinAriaIDs, - * re-exported by name - * for Lab's SelectableCardGroup + * @input The Field input styling rule + * @output `@astryxdesign/core/internal/selectable-card`: useFieldInputStyling, + * re-exported by name for Lab components that compose Field * @position An internal entry reserved for Astryx's own packages: * undocumented, outside the public API and its compatibility promise, * versioned in lockstep with Core, and allowed only in Core and Lab by the * `@astryx/no-core-internal-import` lint rule. Core components import the - * same modules by relative path. Named re-exports only. + * same module by relative path. Named re-exports only. * * SYNC: When modified, update scripts/sync-exports.js. */ -export {SelectableCardGroupContext} from '../SelectableCard/selectableCardGroupContext'; -export type {SelectableCardGroupMembership} from '../SelectableCard/selectableCardGroupContext'; export {useFieldInputStyling} from '../Field/fieldParts'; -export {joinAriaIDs} from '../utils/inputAria'; diff --git a/packages/lab/src/SelectableCardGroup/index.test.ts b/packages/lab/src/SelectableCardGroup/index.test.ts new file mode 100644 index 0000000000000..3445837cd35ce --- /dev/null +++ b/packages/lab/src/SelectableCardGroup/index.test.ts @@ -0,0 +1,25 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. + +/** + * @file index.test.ts + * @input The Lab SelectableCardGroup entry and the Core component + * @output Tests that the Lab entry re-exports the Core component and its props + * @position Testing; validates index.ts + */ + +import {describe, expect, expectTypeOf, it} from 'vitest'; +import { + SelectableCardGroup as CoreSelectableCardGroup, + type SelectableCardGroupProps as CoreSelectableCardGroupProps, +} from '@astryxdesign/core/SelectableCardGroup'; +import {SelectableCardGroup, type SelectableCardGroupProps} from './index'; + +describe('Lab SelectableCardGroup', () => { + it('is the Core component', () => { + expect(SelectableCardGroup).toBe(CoreSelectableCardGroup); + }); + + it('takes the Core props', () => { + expectTypeOf().toEqualTypeOf(); + }); +}); diff --git a/packages/lab/src/SelectableCardGroup/index.ts b/packages/lab/src/SelectableCardGroup/index.ts index 4b138efa7fcff..868026d96d25b 100644 --- a/packages/lab/src/SelectableCardGroup/index.ts +++ b/packages/lab/src/SelectableCardGroup/index.ts @@ -1,8 +1,12 @@ // Copyright (c) Meta Platforms, Inc. and affiliates. /** - * @file SelectableCardGroup component barrel export + * @file SelectableCardGroup re-export + * @input `@astryxdesign/core/SelectableCardGroup` + * @output Re-exports SelectableCardGroup and SelectableCardGroupProps from Core + * @position Lab entry for callers that import the group from Lab; consumed by + * packages/lab/src/index.ts */ -export {SelectableCardGroup} from './SelectableCardGroup'; -export type {SelectableCardGroupProps} from './SelectableCardGroup'; +export {SelectableCardGroup} from '@astryxdesign/core/SelectableCardGroup'; +export type {SelectableCardGroupProps} from '@astryxdesign/core/SelectableCardGroup'; diff --git a/packages/themes/probe/src/probeTheme.ts b/packages/themes/probe/src/probeTheme.ts index 576dda6288d84..0138253759502 100644 --- a/packages/themes/probe/src/probeTheme.ts +++ b/packages/themes/probe/src/probeTheme.ts @@ -4361,6 +4361,38 @@ export const probeTheme = defineTheme({ outlineColor: 'hsl(57.8 86% 25%)', }, }, + 'selectable-card-group': { + base: { + backgroundColor: 'hsl(104.2 78% 53%)', + color: 'hsl(258.0 78% 12%)', + borderColor: 'hsl(184.2 73% 25%)', + outlineColor: 'hsl(40.8 79% 25%)', + }, + 'orientation:horizontal': { + backgroundColor: 'hsl(54.1 83% 59%)', + color: 'hsl(353.8 81% 12%)', + borderColor: 'hsl(104.9 76% 25%)', + outlineColor: 'hsl(30.1 88% 25%)', + }, + 'orientation:vertical': { + backgroundColor: 'hsl(103.7 84% 48%)', + color: 'hsl(3.2 75% 12%)', + borderColor: 'hsl(116.2 80% 25%)', + outlineColor: 'hsl(23.5 79% 25%)', + }, + 'type:single': { + backgroundColor: 'hsl(104.0 89% 45%)', + color: 'hsl(220.7 92% 12%)', + borderColor: 'hsl(184.8 83% 25%)', + outlineColor: 'hsl(181.2 94% 25%)', + }, + 'type:multiple': { + backgroundColor: 'hsl(219.3 77% 55%)', + color: 'hsl(123.6 79% 12%)', + borderColor: 'hsl(101.0 93% 25%)', + outlineColor: 'hsl(268.1 72% 25%)', + }, + }, selector: { base: { backgroundColor: 'hsl(242.1 74% 46%)',