@@ -16,37 +16,43 @@ interface StylingProps {
1616 labelStyle ?: React . CSSProperties ;
1717}
1818
19- interface OptionProps extends StylingProps {
20- index : number ;
21- option : DetailedOption ;
22- isSelected : boolean ;
23- onChange : ( option : DetailedOption ) => void ;
19+ interface OptionLabelProps extends DetailedOption {
20+ index : string | number ;
2421}
2522
26- export function OptionLabel (
27- props : DetailedOption & { index : string | number }
28- ) : JSX . Element {
23+ export const OptionLabel : React . FC < OptionLabelProps > = ( {
24+ index,
25+ label,
26+ title,
27+ value,
28+ } ) => {
2929 const ctx = window . dash_component_api . useDashContext ( ) ;
3030 const ExternalWrapper = window . dash_component_api . ExternalWrapper ;
3131
32- if ( typeof props . label === 'object' ) {
33- const labels =
34- props . label instanceof Array ? props . label : [ props . label ] ;
32+ if ( typeof label === 'object' ) {
33+ const labels = label instanceof Array ? label : [ label ] ;
3534 return (
3635 < >
3736 { labels . map ( ( label , i ) => (
3837 < ExternalWrapper
3938 key = { i }
4039 component = { label }
41- componentPath = { [ ...ctx . componentPath , props . index , i ] }
40+ componentPath = { [ ...ctx . componentPath , index , i ] }
4241 />
4342 ) ) }
4443 </ >
4544 ) ;
4645 }
4746
48- const displayLabel = `${ props . label ?? props . value } ` ;
49- return < span title = { props . title } > { displayLabel } </ span > ;
47+ const displayLabel = `${ label ?? value } ` ;
48+ return < span title = { title } > { displayLabel } </ span > ;
49+ } ;
50+
51+ interface OptionProps extends StylingProps {
52+ index : number ;
53+ option : DetailedOption ;
54+ isSelected : boolean ;
55+ onChange : ( option : DetailedOption ) => void ;
5056}
5157
5258export const Option : React . FC < OptionProps > = ( {
0 commit comments