33import React from 'react' ;
44import PropTypes from 'prop-types' ;
55import { TextField , Autocomplete } from '@mui/material' ;
6- import makeStyles from '@mui/styles/makeStyles ' ;
6+ import { styled } from '@mui/material/styles ' ;
77import { FadingTooltip , ScenarioValidationStatusChip } from '../../misc' ;
88
9- const useStyles = makeStyles ( ( theme ) => ( {
10- validationStatusChip : {
9+ const PREFIX = 'HierarchicalComboBox' ;
10+
11+ const classes = {
12+ validationStatusChip : `${ PREFIX } -validationStatusChip` ,
13+ } ;
14+
15+ const OptionContainer = styled ( 'span' ) ( ( { theme } ) => ( {
16+ [ `& .${ classes . validationStatusChip } ` ] : {
1117 height : '24px' ,
1218 marginLeft : '10px' ,
1319 '&:hover' : {
@@ -33,7 +39,6 @@ export const HierarchicalComboBox = ({
3339 renderInputToolType = '' ,
3440 ...props
3541} ) => {
36- const classes = useStyles ( ) ;
3742 const labels = { ...DEFAULT_LABELS , ...tmpLabels } ;
3843
3944 // 'label' prop is deprecated but is still used as main source of data if provided, otherwise we fallback to the new
@@ -54,14 +59,14 @@ export const HierarchicalComboBox = ({
5459 const marginLeft = option . depth * 20 || 0 ;
5560 return (
5661 < li data-testid = { 'option-' + option . id } { ...props } key = { option . id } >
57- < span style = { { marginLeft } } >
62+ < OptionContainer style = { { marginLeft } } >
5863 { option . name }
5964 < ScenarioValidationStatusChip
6065 className = { classes . validationStatusChip }
6166 status = { option . validationStatus || 'Unknown' }
6267 labels = { labels . validationStatus }
6368 />
64- </ span >
69+ </ OptionContainer >
6570 </ li >
6671 ) ;
6772 } }
0 commit comments