File tree 6 files changed +20
-4
lines changed
6 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 409
409
visibility : hidden;
410
410
}
411
411
412
+ .SingleSelectRadio {
413
+ margin-right : var (--base-size-8 );
414
+ }
415
+
412
416
/* button or a tag */
413
417
414
418
/* [ [spacer] [leadingAction] [leadingVisual] [content] ] */
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import Box from '../Box'
8
8
import { useFeatureFlag } from '../FeatureFlags'
9
9
import classes from './ActionList.module.css'
10
10
import { actionListCssModulesFlag } from './featureflag'
11
+ import Radio from '../Radio'
11
12
12
13
type SelectionProps = Pick < ActionListItemProps , 'selected' | 'className' >
13
14
export const Selection : React . FC < React . PropsWithChildren < SelectionProps > > = ( { selected, className} ) => {
@@ -34,6 +35,17 @@ export const Selection: React.FC<React.PropsWithChildren<SelectionProps>> = ({se
34
35
}
35
36
}
36
37
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
+
37
49
if ( selectionVariant === 'single' || listRole === 'menu' ) {
38
50
if ( enabled ) {
39
51
return (
Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ export type ActionListProps = React.PropsWithChildren<{
124
124
/**
125
125
* Whether multiple Items or a single Item can be selected.
126
126
*/
127
- selectionVariant ?: 'single' | 'multiple'
127
+ selectionVariant ?: 'single' | 'radio' | ' multiple'
128
128
/**
129
129
* Display a divider above each `Item` in this `List` when it does not follow a `Header` or `Divider`.
130
130
*/
Original file line number Diff line number Diff line change @@ -545,7 +545,7 @@ export function SelectPanel({
545
545
// we don't accidentally override props.aria-label
546
546
aria-labelledby = { listProps [ 'aria-label' ] ? undefined : titleId }
547
547
aria-multiselectable = { isMultiSelectVariant ( selected ) ? 'true' : 'false' }
548
- selectionVariant = { isMultiSelectVariant ( selected ) ? 'multiple' : 'single' }
548
+ selectionVariant = { isSingleSelectModal ? 'radio' : isMultiSelectVariant ( selected ) ? 'multiple' : 'single' }
549
549
items = { itemsToRender }
550
550
textInputProps = { extendedTextInputProps }
551
551
loading = { loading || isLoading }
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ export interface ItemProps extends SxProp {
84
84
/**
85
85
* For `Item`s which can be selected, whether `multiple` `Item`s or a `single` `Item` can be selected
86
86
*/
87
- selectionVariant ?: 'single' | 'multiple'
87
+ selectionVariant ?: 'single' | 'multiple' | 'radio'
88
88
89
89
/**
90
90
* 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 {
67
67
/**
68
68
* For `Item`s which can be selected, whether `multiple` `Item`s or a `single` `Item` can be selected
69
69
*/
70
- selectionVariant ?: 'single' | 'multiple'
70
+ selectionVariant ?: 'single' | 'multiple' | 'radio'
71
71
72
72
/**
73
73
* 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