File tree Expand file tree Collapse file tree 6 files changed +20
-4
lines changed Expand file tree Collapse file tree 6 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 409409 visibility : hidden;
410410}
411411
412+ .SingleSelectRadio {
413+ margin-right : var (--base-size-8 );
414+ }
415+
412416/* button or a tag */
413417
414418/* [ [spacer] [leadingAction] [leadingVisual] [content] ] */
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import Box from '../Box'
88import { useFeatureFlag } from '../FeatureFlags'
99import classes from './ActionList.module.css'
1010import { actionListCssModulesFlag } from './featureflag'
11+ import Radio from '../Radio'
1112
1213type SelectionProps = Pick < ActionListItemProps , 'selected' | 'className' >
1314export const Selection : React . FC < React . PropsWithChildren < SelectionProps > > = ( { selected, className} ) => {
@@ -34,6 +35,17 @@ export const Selection: React.FC<React.PropsWithChildren<SelectionProps>> = ({se
3435 }
3536 }
3637
38+ if ( selectionVariant === 'radio' ) {
39+ return (
40+ < VisualContainer className = { className } >
41+ { /* This is just a way to get the visuals from Radio, but it should be ignored in terms of accessibility */ }
42+ < div aria-hidden = "true" >
43+ < Radio className = { classes . SingleSelectRadio } value = "unused" checked = { selected } />
44+ </ div >
45+ </ VisualContainer >
46+ )
47+ }
48+
3749 if ( selectionVariant === 'single' || listRole === 'menu' ) {
3850 if ( enabled ) {
3951 return (
Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ export type ActionListProps = React.PropsWithChildren<{
124124 /**
125125 * Whether multiple Items or a single Item can be selected.
126126 */
127- selectionVariant ?: 'single' | 'multiple'
127+ selectionVariant ?: 'single' | 'radio' | ' multiple'
128128 /**
129129 * Display a divider above each `Item` in this `List` when it does not follow a `Header` or `Divider`.
130130 */
Original file line number Diff line number Diff line change @@ -545,7 +545,7 @@ export function SelectPanel({
545545 // we don't accidentally override props.aria-label
546546 aria-labelledby = { listProps [ 'aria-label' ] ? undefined : titleId }
547547 aria-multiselectable = { isMultiSelectVariant ( selected ) ? 'true' : 'false' }
548- selectionVariant = { isMultiSelectVariant ( selected ) ? 'multiple' : 'single' }
548+ selectionVariant = { isSingleSelectModal ? 'radio' : isMultiSelectVariant ( selected ) ? 'multiple' : 'single' }
549549 items = { itemsToRender }
550550 textInputProps = { extendedTextInputProps }
551551 loading = { loading || isLoading }
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ export interface ItemProps extends SxProp {
8484 /**
8585 * For `Item`s which can be selected, whether `multiple` `Item`s or a `single` `Item` can be selected
8686 */
87- selectionVariant ?: 'single' | 'multiple'
87+ selectionVariant ?: 'single' | 'multiple' | 'radio'
8888
8989 /**
9090 * Designates the group that an item belongs to.
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ export interface ListPropsBase {
6767 /**
6868 * For `Item`s which can be selected, whether `multiple` `Item`s or a `single` `Item` can be selected
6969 */
70- selectionVariant ?: 'single' | 'multiple'
70+ selectionVariant ?: 'single' | 'multiple' | 'radio'
7171
7272 /**
7373 * Whether to display a divider above each `Item` in this `List` when it does not follow a `Header` or `Divider`.
You can’t perform that action at this time.
0 commit comments