11// @flow
22
3- import React , { Component } from 'react' ;
4- import type { Node } from 'react' ;
3+ import React , { Component , type ElementProps } from 'react' ;
54import classNames from 'classnames' ;
65import { inject , observer } from 'mobx-react' ;
76import { type Store } from '../accordionStore/accordionStore' ;
87
9- type AccordionItemTitleProps = {
10- children : Node ,
11- className : string ,
8+ type AccordionItemTitleProps = ElementProps < 'div' > & {
129 hideBodyClassName : string ,
1310 accordionStore : Store ,
1411 uuid : string | number ,
@@ -57,7 +54,13 @@ class AccordionItemTitle extends Component<
5754
5855 render ( ) {
5956 const { items, accordion } = this . props . accordionStore ;
60- const { uuid, children, className, hideBodyClassName } = this . props ;
57+ const {
58+ uuid,
59+ className,
60+ hideBodyClassName,
61+ accordionStore,
62+ ...rest
63+ } = this . props ;
6164 const foundItem = items . find ( item => item . uuid === uuid ) ;
6265 if ( ! foundItem ) return null ;
6366
@@ -82,9 +85,8 @@ class AccordionItemTitle extends Component<
8285 tabIndex = "0" // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
8386 onKeyPress = { this . handleKeyPress }
8487 disabled = { disabled }
85- >
86- { children }
87- </ div >
88+ { ...rest }
89+ />
8890 ) ;
8991 }
9092 return (
@@ -98,9 +100,8 @@ class AccordionItemTitle extends Component<
98100 tabIndex = "0" // eslint-disable-line jsx-a11y/no-noninteractive-tabindex
99101 onKeyPress = { this . handleKeyPress }
100102 disabled = { disabled }
101- >
102- { children }
103- </ div >
103+ { ...rest }
104+ />
104105 ) ;
105106 }
106107}
0 commit comments