@@ -34,7 +34,7 @@ export interface ExpandableListItemProps extends BaseProps {
3434 readonly expandedItems : ReadonlyArray < string >
3535 readonly setExpandedItems : Dispatch < SetStateAction < ReadonlyArray < string > > >
3636 readonly isNestedItem : boolean
37- readonly isAccordion : boolean
37+ readonly accordion ? : boolean
3838}
3939
4040/**
@@ -51,7 +51,7 @@ export const ExpandableListItem: React.VFC<ExpandableListItemProps> = ({
5151 expandedItems,
5252 setExpandedItems,
5353 isNestedItem,
54- isAccordion ,
54+ accordion = false ,
5555 ...props
5656} ) => {
5757 const { id, label, icon, selected = false , onClick, items } = item
@@ -63,7 +63,7 @@ export const ExpandableListItem: React.VFC<ExpandableListItemProps> = ({
6363 if ( expandedItems . includes ( itemId ) ) {
6464 // Close the expanded item
6565 nextExpandedItems = expandedItems . filter ( i => i !== itemId )
66- } else if ( isAccordion ) {
66+ } else if ( accordion ) {
6767 // Only add one expanded item when accordion
6868 nextExpandedItems = [ id ]
6969 } else {
@@ -73,7 +73,7 @@ export const ExpandableListItem: React.VFC<ExpandableListItemProps> = ({
7373
7474 setExpandedItems ( nextExpandedItems )
7575 } ) ( id ) ,
76- [ expandedItems , id , isAccordion , setExpandedItems ]
76+ [ expandedItems , id , accordion , setExpandedItems ]
7777 )
7878 const hasChildren = items !== undefined
7979 const onItemClick = hasChildren ? onChildClick : onClick
@@ -105,7 +105,7 @@ export const ExpandableListItem: React.VFC<ExpandableListItemProps> = ({
105105 expandedItems = { expandedItems }
106106 setExpandedItems = { setExpandedItems }
107107 isNestedItem = { true }
108- isAccordion = { isAccordion }
108+ accordion = { accordion }
109109 />
110110 ) ) }
111111 </ ExpandableListContainer >
0 commit comments