feat(ButtonGroup): add segmented ButtonGroup to next entry#1138
Conversation
Add a ButtonGroup component (exported from @scality/core-ui/next) that restyles its child Buttons into a single segmented control. Inspired by MUI's ButtonGroup/ToggleButtonGroup but kept minimal for maestro's use case (sort by / group by controls in the deployments list header): - joins child Buttons into one bordered group, collapsing their individual radii/borders into shared separators - optional single-select toggle via `value` + `onChange`; the child whose `value` matches is highlighted (aria-pressed), `null` selects none - `orientation` for horizontal (default) or vertical layouts - without `value`/`onChange` it is a plain visual cluster of buttons Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Hello damiengillesscality,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
A valueless child in selectable mode is a no-op on click, so it must not advertise a toggle/pressed state to assistive tech. Inject aria-pressed only when the child carries a value. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
/approve |
In the queueThe changeset has received all authorizations and has been added to the The changeset will be merged in:
There is no action required on your side. You will be notified here once IMPORTANT Please do not attempt to modify this pull request.
If you need this pull request to be removed from the queue, please contact a The following options are set: approve |
|
I have successfully merged the changeset of this pull request
Please check the status of the associated issue None. Goodbye damiengillesscality. |
Summary
Adds a
ButtonGroupcomponent, exported from@scality/core-ui/next, that restyles its childButtons into a single segmented control.This generalises the local
SegmentedControl/SegmentedGroupintroduced in artesca-maestro#650 (the deployments-list "Sort by" / "Group by" controls) into a reusable core-ui component, so maestro can drop its bespokestyled.div/styled.buttonand consume this instead.The API is inspired by MUI's
ButtonGroup/ToggleButtonGroupbut kept intentionally minimal and adapted to our use case.API
value+onChangevalue; the matching child is highlighted (aria-pressed). Passnullfor no selection.orientation'horizontal'(default) or'vertical'.Buttons. Withoutvalue/onChangethe group is a plain visual cluster, each child keeping its ownonClick.Behaviour
backgroundLevel1,textPrimary,selectedActive) — same look as the original maestro control.nullvalue renders no selection (supports maestro's clearable "Group by").Stories
Components/ButtonGroup: SortBy, GroupByClearable, Vertical, PlainGroup, Playground.Tests
5 unit tests (rendering,
aria-pressedselection,onChangepayload, childonClickpreservation, no selection props withoutonChange).eslintandtsc --noEmitclean.