@@ -7,12 +7,15 @@ import Box, {BoxProps} from '../Box'
77import sx , { SxProp , merge } from '../sx'
88import createSlots from '../utils/create-slots'
99import { AriaRole } from '../utils/types'
10- import { ListContext , ListProps } from './List'
11- import { GroupContext , GroupProps } from './Group'
10+ import { ListContext , ActionListProps } from './List'
11+ import { GroupContext , ActionListGroupProps } from './Group'
1212import { ActionListContainerContext } from './ActionListContainerContext'
1313import { Selection } from './Selection'
1414
15- export const getVariantStyles = ( variant : ItemProps [ 'variant' ] , disabled : ItemProps [ 'disabled' ] ) => {
15+ export const getVariantStyles = (
16+ variant : ActionListItemProps [ 'variant' ] ,
17+ disabled : ActionListItemProps [ 'disabled' ]
18+ ) => {
1619 if ( disabled ) {
1720 return {
1821 color : 'primer.fg.disabled' ,
@@ -39,7 +42,7 @@ export const getVariantStyles = (variant: ItemProps['variant'], disabled: ItemPr
3942 }
4043}
4144
42- export type ItemProps = {
45+ export type ActionListItemProps = {
4346 /**
4447 * Primary content for an Item
4548 */
@@ -79,15 +82,15 @@ export type ItemProps = {
7982
8083const { Slots, Slot} = createSlots ( [ 'LeadingVisual' , 'InlineDescription' , 'BlockDescription' , 'TrailingVisual' ] )
8184export { Slot }
82- export type ItemContext = Pick < ItemProps , 'variant' | 'disabled' > & {
85+ export type ItemContext = Pick < ActionListItemProps , 'variant' | 'disabled' > & {
8386 inlineDescriptionId : string
8487 blockDescriptionId : string
8588}
8689
8790const LiBox = styled . li < SxProp > ( sx )
8891export const TEXT_ROW_HEIGHT = '20px' // custom value off the scale
8992
90- export const Item = React . forwardRef < HTMLLIElement , ItemProps > (
93+ export const Item = React . forwardRef < HTMLLIElement , ActionListItemProps > (
9194 (
9295 {
9396 variant = 'default' ,
@@ -106,12 +109,12 @@ export const Item = React.forwardRef<HTMLLIElement, ItemProps>(
106109 const { selectionVariant : groupSelectionVariant } = React . useContext ( GroupContext )
107110 const { container, afterSelect, selectionAttribute} = React . useContext ( ActionListContainerContext )
108111
109- let selectionVariant : ListProps [ 'selectionVariant' ] | GroupProps [ 'selectionVariant' ]
112+ let selectionVariant : ActionListProps [ 'selectionVariant' ] | ActionListGroupProps [ 'selectionVariant' ]
110113 if ( typeof groupSelectionVariant !== 'undefined' ) selectionVariant = groupSelectionVariant
111114 else selectionVariant = listSelectionVariant
112115
113116 /** Infer item role based on the container */
114- let itemRole : ItemProps [ 'role' ]
117+ let itemRole : ActionListItemProps [ 'role' ]
115118 if ( container === 'ActionMenu' || container === 'DropdownMenu' ) {
116119 if ( selectionVariant === 'single' ) itemRole = 'menuitemradio'
117120 else if ( selectionVariant === 'multiple' ) itemRole = 'menuitemcheckbox'
@@ -257,7 +260,7 @@ export const Item = React.forwardRef<HTMLLIElement, ItemProps>(
257260 </ Slots >
258261 )
259262 }
260- ) as PolymorphicForwardRefComponent < 'li' , ItemProps >
263+ ) as PolymorphicForwardRefComponent < 'li' , ActionListItemProps >
261264
262265Item . displayName = 'ActionList.Item'
263266
0 commit comments